Check for XML Schema Collection?

scripting for Sql Server 2005. I am registering a schema with

CREATE XML SCHEMA COLLECTION [dbo].[MySchema] AS N'<xsd:schema ... >' 

Now that I am making changes, I would like to discard it, say, by calling

 DROP XML SCHEMA COLLECTION [dbo].[MySchema] 

I run this material quite often as I develop, for example

 DROP ... CREATE ... 

but this creates problems in the first run, where the circuit does not exist. I would like to do something similar to

 IF OBJECT_ID ('MySchema') IS NOT NULL DROP ... CREATE ... 

but OBJECT_ID ('MySchema') just returns NULL . Is there a way to check for a registered collection of Xml schemas on Sql Server 2005?

muchos gracias mis amigos :)

+4
source share
1 answer

Check sys.xml_schema_collections :

 IF EXISTS (SELECT * FROM sys.xml_schema_collections WHERE name = 'MySchema') 
+13
source

All Articles