|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XML SchemaHallo!
I wondered if anyone can help me with why there is a N' in front of so many of the expressions in create statements? Like this one. CREATE XML SCHEMA COLLECTION DeliverySchemas AS N'<?xml version="1.0" ?> Thanks! H It is the way you express a Unicode string.
-- Show quoteTibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://www.solidqualitylearning.com/ "Hege M" <He***@discussions.microsoft.com> wrote in message news:9FA0AC1B-AF43-4A41-BB3D-D731B6D6D148@microsoft.com... > Hallo! > > I wondered if anyone can help me with why there is a N' in front of so many > of the expressions in create statements? Like this one. > CREATE XML SCHEMA COLLECTION DeliverySchemas > AS > N'<?xml version="1.0" ?> > > Thanks! > H > Hello Hege,
> I wondered if anyone can help me with why there is a N' in front of so Justing adding a bit of depth to Tibor's answer. For SQL Server 2005, the > many > of the expressions in create statements? Like this one. > CREATE XML SCHEMA COLLECTION DeliverySchemas > AS > N'<?xml version="1.0" ?> schema's textual presentation must matching its actual encoding. When SQL Server 2005 attempts to parse and store XML, it looks at two things: 1. From a T-SQL prespective, was the literal text value presented as single-byte-per-character text (essentially ASCII) or as double-byte-per-character text. In SQL Server, prefixing an 'N' (note that capitial N is required) tells T-SQL to treat what follows as a double-byte string. Note that this behavior is true for databases setup in the an English configuration, where textual values are assumed to single-byte by default. This behavior may vary for versions of SQL Server localized to double-byte languages. I've never installed SQL in Japanesse, for example, to see what the actual behavior is. 2. As XMLRW begins parsing the XML, it looks at the prologue for an encoding attribute (e.g., encoding="utf-8", encoding="utf-16", etc). If this fails to immediately match the expected byte-per-character-count from #1, an error is raised. Otherwise, processing continues. Thank you, Kent Tegels DevelopMentor http://staff.develop.com/ktegels/ |
|||||||||||||||||||||||