Reputation: 388
I have a need to record XML fragments in a SQL Server 2005 database for logging purposes (SOAP messages, in this case). Is there any reason to use the XML datatype over a simple varchar or nvarchar column?
I can see instances already where being able to use XPath to get into the data in the XML would be rather nice, and I haven't been able to find any real downsides in some brief research.
Are there any pitfalls that need to be watched out for or is there a better way to approach this?
Upvotes: 3
Views: 361
Reputation: 23236
Here's a great forum post on the topic. In general, use XML datatypes if you forsee needing the XML manipulation and typing functionality.
Upvotes: 3
Reputation: 65491
The only problem we have encountered is that writing queries against the data is more difficult.
In some cases we have stored data in XML and later dumped it into tables for reporting.
Upvotes: 0
Reputation: 15609
Depending upon the size of xml and the ability of extracting particular information from within the xml, it can become a drawback. Did you consider storing the xml on the file system and just having the path in the database?
Upvotes: 0