June 16, 2005 at 8:25 am
I have to generate an XMl from a SQL Server 2000 table. Using the clause FOR XML i can only send the result to screen or to file.
I want, instead, store the result, into a field column in another table. There's a way i can do it without passing through a file (and OpenXML)?
tnks in advance
andrea
June 16, 2005 at 10:02 am
in sql 2000, the for xml clause cannot be captured into any variable, table or other server object. Generally, FOR XML cannot be used for any selections that do not produce direct output to the Microsoft® SQL Server™ 2000 client. I think it is because the output is built similar to a TEXT or IMAGE field and streamed to the ODBC driver or dataadapter, and you cannot manipulate the stream.
here's the authoritative link to a microsft whitepaper on what you can and cannot do;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsql/ac_openxml_0alh.asp
about the only thing i can think is to dimp it to a file, and then read it back so you can manipulate it, but that is exactly what you wanted to avoid. sql 2005 has much better xml support, of course.
maybe you could write your own procedure, which returns a varchar(8000) or preferably a TEXT field, which parses results you requested into an XML format; maybe there is already such a function in the contributions here on ssc:
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply