Re: Select Into With SELECT FROM for xml auto
- From: "Michael Rys [MSFT]" <mrys@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 May 2005 11:51:35 -0700
There are some ugly sp_OA stored proc tricks that I rather not further
propagate since you will be able to insert and assign FOR XML expressions
starting with SQL Server 2005 to your hearts content.
Best regards
Michael
"Dennis Redfield" <dennis_redfield@xxxxxxxxxxxxxxxx> wrote in message
news:Ofu2zrtWFHA.580@xxxxxxxxxxxxxxxxxxxxxxx
> well the error I get is --"The FOR XML clause is not allowed in a SELECT
> INTO statement." All well and good.
> the following is also forbidden:
> insert into #temp
> SELECT top 1 * FROM dbo.sysobjects for xml auto --The FOR XML clause is
> not allowed in a SELECT INTO statement.
> "The FOR XML clause is not allowed in a INSERT statement."
>
> My appoach to your goal would be to use client code [ADO or .NET] to get
> the
> string and then push it back up the pipe as an insert statement.
>
> Would love to see if any one has a T-SQL trick to accomplish this....
>
> dlr
> "Guilherme" <Guilherme@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:392D1600-F352-42DB-87C2-BABE01A77C19@xxxxxxxxxxxxxxxx
>> Hi,
>>
>> I need to select the first row of some table as XML data, and put the
>> returned value in a variable to use within a insert later.
>>
>> I tried something like:
>> go
>> SET nocount ON DECLARE @str varchar
>> SELECT top 1 * into @str FROM cliente for xml auto -- error in this line
>> print @str
>>
>> I need to get the value in the @str value, I'll use this variable in an
>> insert. But the name of column returned via "select for xml" is very
> strange.
>> How do I solve this issue?
>>
>> Thanks
>>
>
>
.
- References:
- Select Into With SELECT FROM for xml auto
- From: Guilherme
- Re: Select Into With SELECT FROM for xml auto
- From: Dennis Redfield
- Select Into With SELECT FROM for xml auto
- Prev by Date: Re: Select Into With SELECT FROM for xml auto
- Next by Date: Re: For XML Problem with IIS6 and W2k3
- Previous by thread: Re: Select Into With SELECT FROM for xml auto
- Next by thread: Re: Select Into With SELECT FROM for xml auto
- Index(es):
Relevant Pages
|