Re: Select Into With SELECT FROM for xml auto



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
>>
>
>


.



Relevant Pages

  • Re: multiple siblings, using tDOM to generate XML
    ... A simple way to generate XML is the following: ... proc map { ... return [string map $mapTEXT2XML $str] ... set doc ...
    (comp.lang.tcl)
  • Re: REXML memory consumption
    ... I created a test that consisted of feeding 10 xml ... I would think that memory usage ... Is there something wrong with my understanding of Ruby or does REXML ... str << line ...
    (comp.lang.ruby)
  • Re: REXML memory consumption
    ... I would think that memory usage ... Is there something wrong with my understanding of Ruby or does REXML ... str << line ... No need to read the whole file into a large string before it is parsed as XML. ...
    (comp.lang.ruby)
  • Re: How to check if a string is an XML before calling LoadXML(str)
    ... I am new to C# so I might be asking some silly questions. ... if the str is not XML then I would like to do something else instead of being ... >> return but only throw exception if str is not XML document. ...
    (microsoft.public.dotnet.languages.csharp)