"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 Thursday, January 14, 2010 5:14 PM by simonsabin
Filed under: , ,

Comments

Thursday, January 14, 2010 7:08 PM 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

Thursday, January 14, 2010 7:56 PM 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

Friday, January 15, 2010 7:36 PM by SqlServerKudos

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

Kudos for a great Sql Server article - Trackback from SqlServerKudos