Most of the columns discussed in this section, except the Diagram column in the Illustration table, are typed xml columns. For more information, see Typed XML Compared to Untyped XML. To see the XML schemas that are used for these columns, go to this Microsoft Web site.
The following query returns a list of XML schema collections from the AdventureWorks database. For more information about the XML schema collection, see Managing XML Schema Collections on the Server.
USE AdventureWorks
GO
SELECT *
FROM sys.xml_schema_collections
-- Result shows the list of XML schema collection names.
AdditionalContactInfoSchemaCollection
IndividualSurveySchemaCollection
HRResumeSchemaCollection
ProductDescriptionSchemaCollection
ManuInstructionsSchemaCollection
StoreSurveySchemaCollection
The following query returns the XML schema collection names with the relational schema name:
SELECT xsc.xml_collection_id,
s.name + '.' + xsc.name as xml_collection,
xsc.principal_id, xsc.create_date, xsc.modify_date
FROM sys.xml_schema_collections xsc
JOIN sys.schemas s
ON xsc.schema_id = s.schema_id
The xml_collection column in the result returns the following XML schema collections in the AdventureWorks database:
-
Person.AdditionalContactInfoSchemaCollection
-
Sales.IndividualSurveySchemaCollection
-
HumanResources.HRResumeSchemaCollection
-
Production.ProductDescriptionSchemaCollection
-
Production.ManuInstructionsSchemaCollection
-
Sales.StoreSurveySchemaCollection
-
sys.sys
For more information about the sys.sys XML schema collection, see Built-in XML Schema Collection (sys).
You can use the xml_schema_namespace intrinsic function to reconstruct the XML schema collection as follows:
SELECT xml_schema_namespace(N'Person',N'AdditionalContactInfoSchemaCollection')
GO
SELECT xml_schema_namespace(N'Sales',N'IndividualSurveySchemaCollection')
GO
SELECT xml_schema_namespace(N'HumanResources',N'HRResumeSchemaCollection')
GO
SELECT xml_schema_namespace(N'Production',N'ProductDescriptionSchemaCollection')
Go
SELECT xml_schema_namespace(N'Production',N'ManuInstructionsSchemaCollection')
GO
SELECT xml_schema_namespace(N'Sales',N'StoreSurveySchemaCollection')
GO
For more information, see Viewing a Stored XML Schema Collection.