"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 Project

I mentioned there is one gotcha about. The gotcha is if you have UTF-8  encoded schemas then they fail to be deployed. This is because they get deployed using

CREATE XML SCHEMA COLLECTION [dbo].[LogiPointRec]
    AS N'<?xml version="1.0" encoding="UTF-8"?>

Note the N' this results in the following error

XML parsing: line 1, character 38, unable to switch the encoding

To get round this I haven't found a way for Database Professional to not use the unicode prefix, so you have to change to UTF-16 encoding of you schema. I've reported this here https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=524977 so please vote if you have the same problem.


Published 14 January 2010 17:14 by simonsabin
Filed under: , ,

Comments

14 January 2010 19:08 by Simon Sabin UK SQL Consultant's Blog

# 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

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

# 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

15 January 2010 19:36 by SqlServerKudos

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

Kudos for a great Sql Server article - Trackback from SqlServerKudos