USING THE XML DATA TYPE IN TABLES used to improve the performance of the functions associated with an XML data type. In addition to the previous example that created a single XMLtype column in a table, you can have tables that contain more than one XMLdata type column. You can create a table with an XML column in local or global temporary tables as well as ordinary tables. An XML data type column can be used in a VIEWas well. XMLdata type columns have certain limitations when used in tables. They may not be declared as a PRIMARYKEYin a table. They may not be declared as a FOREIGNKEYin a table. They may not be declared with a UNIQUEconstraint. They may not be declared with the COLLATEkeyword. These first three limitations exist because individual instances of the XML data type may not be compared with each other. Although it would not be difficult to perform a string comparison with XML data, it would be an order of magnitude more difficult to perform a comparison at the Infoset level. For example, the two XML documents in the following example are Infoset-equivalent, but not lexically equivalent. < ! These two documents are equivalent > The XMLdata type cannot use the COLLATEkeyword, because XML provides its own encoding via the encoding attribute on the XML document declaration. The following code is an example of using encoding. If the document uses an encoding that is unknown or unsupported, SQL Server will return an error. An error will also result if the content does not match the specified encoding; for example, the encoding specifies UTF-16 but contains characters encoded as ANSI. Although encoding specified in the XML document declaration is preserved, documents are always physically stored as UTF-16. < ! This works correctly > < ?xml version= 1.0 encoding= utf-8 ?>

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services

Bookmark the permalink.

Comments are closed.