for xml… | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

for xml…

for what purpose do we use "for xml" clause in select clause. is it possible to load data from a .xml file into tables without using bcp??? help pls… Thanks,
Ram "It is easy to write code for a spec and walk in water, provided, both are freezed…"
As far as I know, the FOR XML clause is for outputting data in XML format. We tried it once, but you pretty much have to accept the automatic tagging – which in our case was not the required tagging. We ended up concatenating the required tags in a regular SELECT, and using lots of UNION ALL to serialize the XML from a normalized data structure. Ah yes, and covering unicode characters was great fun. For reading XML files, there is the OPENXML function that you can call in your FROM clause – see BOL > FOR XML clause > Retrieving and Writing XML Data.
hmmm…i was trying to know about that. i used that for xml in the select query and copied the result into a xml file and executed that only to see that it throws an error [<img src=’/community/emoticons/emotion-6.gif’ alt=’:(‘ />]. then i added a parent tag to the file and got that executed successfully. but i didnt know the exact use of doing that way. thats why i asked this. still i am unaware of where this could be used… [<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]<br /><br />Thanks,<br />Ram<br /><br />"It is easy to write code for a spec and walk in water, provided, both are freezed…"
Sorry for putting the most relevant part last –
quote:For reading XML files, there is the OPENXML function that you can call in your FROM clause – see BOL > FOR XML clause > Retrieving and Writing XML Data.

[8D] Thanks,
Ram "It is easy to write code for a spec and walk in water, provided, both are freezed…"
]]>