简体   繁体   中英

Get XML schema used by sql column

I want to select xml schema assigned to a xml column in my SQL Server database, from a SQL statement.

I am stuck, I've looked in information_schema.columns with no luck, I can just alter it.

In Management Studio, in column properties under Xml Type Specification I can set (scheme collection) I want to simply select this from SQL statement.

Thanks for your help.

Something like this should do it.

select C2.name
from sys.columns as C1
  inner join sys.xml_schema_collections as C2
    on C1.xml_collection_id = C2.xml_collection_id
where C1.object_id = object_id('TableName') and
      C1.name = 'ColumnName'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM