XML Schema Collection in Database Professional Project

If you are wanting to use schemas in your database using database professional then it is not that obvious.

You can add XML SCHEMA COLLECTIONs but where do they do to. They are tuck away in the programability node under types, not the most obvious location.

Secondly if you create schemas using the ADD file option you will be presented with a file like,.

CREATE XML SCHEMA COLLECTION [dbo].[XMLSchemaCollection1]

    AS N'[xml_schema]'

Thats not too great if you already have your schemas and/or want to use the schema tools in visual studio. You don't want to have to copy the schema into the string bit of the declaration

The trick is to add an XSD reference. This allows you to reference an existing file and so you can use the xsd schema tools.

Right click on the references node in your database project and select Add XSD Reference.

My preference is to add a folder in your project and then reference the files in there. That way the references are relative and the schemas are part of your database project.

There is one gotcha and thats to do with encoding which I've blogged about here "unable to switch the encoding" when deploying XML Schemas using Database Professional


Published 14 January 2010 19:05 by simonsabin

Comments

14 January 2010 19:57 by SimonS Blog on SQL Server Stuff

# "unable to switch the encoding" when deploying XML Schemas using Database Professional

I've just blogeed about how to use XML Schema Collections in Visual Studio Database Professional

16 January 2010 11:56 by SqlServerKudos

# XML Schema Collection in Database Professional Project

Kudos for a great Sql Server article - Trackback from SqlServerKudos

# "unable to switch the encoding" when deploying XML Schemas using Database Professional - Simon Sabin UK SQL Consultant's Blog

Pingback from  "unable to switch the encoding" when deploying XML Schemas using Database Professional - Simon Sabin UK SQL Consultant's Blog