October 14, 2008 at 8:26 am
Hi Guys
I have created a table with XML Datatype Column, Inserted data in it.
But when i try to query as usual T-sql .it has diffeten XML Code versionn
What is the way to query the table to get retrive data from table which holds
XML Data type column.
or provide me how this datatype works.
any kind of informaion is appriciated.
October 14, 2008 at 8:44 am
Kind of a broad question. I will start with this: Can you get away with not having XML in the database? You will save yourself a lot of heartache by not having it there....
Normal selects work to retrieve the XML, like the below gets me the XML data back.
select xmlData from TableA
Now this will return just the xml blob itself, it will not pull out the attributes/values for it. For that look in books online for xml queries, xpath etc. There has also been a few excellent series on xml on this website recently.
October 14, 2008 at 9:24 am
Also - keep in mind that the second you put XML information into an XML data type, SQL Server will reorganize that data in any which way it feels like to optimize using that information. In most cases - it will use the header and version info only as long as it needs it to get data out, and it will instead store a series of XML fragments spread across however many rows are appropriate.
If you want to store XML documents and have them be UNMODIFIED, be sure to store it in a varchar or Nvarchar column. vastly different purposes for the two things.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply