CREATE TABLE MyXMLOrderTable
(OrderID int NOT NULL PRIMARY KEY, OrderDetail xml, LoadDate datetime);
Untyped XML is used when DBA/Developer need to load XML that does not conform to its specified schema, DBA/Developer does not have defined schemas, or the XML has already been validated and DBA/Developer does not need to perform validation on the server. DBA/Developer should not create a schema collection before importing the XML documents. Schema collections are used to validate XML. In this scenario, the XML is validated by a client application. Therefore, this task does not need to be performed on the database server. DBA/Developer should not use FILESTREAM storage for the XML documents. In this scenario, DBA/Developer wanted to store the XML documents in the database. FILESTREAM storage is used to store data outside the database on the file system. DBA/Developer should not use typed XML when storing the XML documents because in this scenario, DBA/Developer did not need to perform validation. Typed XML can be used if XML needs to validated, such as if DBA/Developer needs to validate that the XML has valid data types and values for specific elements and attributes. To create a typed xml column or variable, DBA/Developer must first use the CREATE XML SCHEMA COLLECTION statement to create a schema used to validate the XML. Then, DBA/Developer can use the schema collection when declaring an xml variable or creating an xml column in a table. DBA/Developer can also use an existing XSD when DBA/Developer creates the schema collection, if one exists.
No comments:
Post a Comment