Let's quickly see how to create a table with the XML data type and store an XML document in that table.
As shown in the query above, we created the Address column with the XML data type and inserted XML data using CAST function. The CAST function also ensures that the XML document is well formed. If the XML was not well formed, as in this line shown below,
then an XML Parsing error would be raised - XML parsing: line 1, character 51, unexpected end of input
You can even add XML Schema definitions to SQL Server and use it to validate XML documents. We will see this feature in one of the forthcoming blog posts.
Did you like this post?
|subscribe via rss||subscribe via e-mail|
|print this post||follow me on twitter|