Wednesday, March 28, 2012

Incorrect syntax near XML-While creating XML Schema

Hi,

Im trying to create a xml schema like


CREATE XML SCHEMA COLLECTION BooksSchemaCollection AS
N'<?xml version="1.0" encoding="UTF-16"?>
<xsd:schema elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="book">
<xsd:complexType mixed="false">
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
<xsd:element name="publisher" type="xsd:string"/>
<xsd:element name="cost" type="xsd:integer"/>
<xsd:element name="comments" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>';

But when i execute , im getting a error like Incorrect syntax near 'XML' .any one know why its comming??

Thanks

Hi ,

I use SqlServer 2005 and above SQL statement works fine on my pc.

Make sure you have correct permission.

To create an XML SCHEMA COLLECTION requires at least one of the following sets of permissions:

CONTROL permission on the server
ALTER ANY DATABASE permission on the server
ALTER permission on the database
CONTROL permission in the database
ALTER ANY SCHEMA permission and CREATE XML SCHEMA COLLECTION permission in the database
ALTER or CONTROL permission on the relational schema and CREATE XML SCHEMA COLLECTION permission in the database
sql

No comments:

Post a Comment