FOR XML into table

  • Is it possible write the result of a query with FOR XML clause into a text column of a table??

    If yes then how would can I do it. I am looking for an all SQL solution in SQL 2000.

    Thanx in advance

  • Insert into and select into wont work. One that stretches the definition a little would be to use ADO and the sp_oa procs to grab the result as a stream, push into a string variable, then do the insert. Maybe a hack using openrowset around the select? Havent tried.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • I used sp_executesql with openrowset to put the result into a global tmp table thou it creates a column name with XML_xxx_xxxxx_xxx etc.

    I can't figure out how I can insret the text field in the regular table from the temp table I created.

    Writetext expects actual string for the text

    but will not take a select from ##tmp.

    I can not move the data into a varchar var since 8000 char will not be enought to store the xml result.

    Thnaks for the idea with OA sprocs I will try that don't think I will have any problems with that, thou I did not want to use it initially, but at this point I don't think I have another choice.

    Thanx again

    Dan

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply