Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 xml data type

Author  Topic 

kpgraci
Yak Posting Veteran

68 Posts

Posted - 2012-05-23 : 10:05:12
I have xml data I want to store in a table along with other data, so I'm looking at the xml data type.

Normally I would use a varchar(max) for this kind of data, but I do plan on storing well formed xml, so are there any pitfalls to this?

I know I can accomplish what I want to do very easily with a varchar field, so will the xml field be just as easy to write quries for or are there things I need to be careful of?

Also, what is the max size of xml that can be stored?



kpg

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2012-05-23 : 10:22:08
Just over 1 GB, since the XML column is unicode capable.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-05-23 : 11:28:59
There are not pitfalls as long as you know the XML you're storing is well-formed. In fact this guarantees it, whereas storing it as varchar or nvarchar cannot. You also have the option of using XML methods to navigate nodes, and can use XML indexing for performance if needed.
Go to Top of Page
   

- Advertisement -