Showing posts with label schema. Show all posts
Showing posts with label schema. Show all posts

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

Sunday, February 19, 2012

In the server explorer "generate create script" is greyed out, whats wrong?

In the server explorer "generate create script" is greyed out, what am I doing wrong?
I want to generate a script that will re-create my DB schema on another machine.
Any help would be appreciated.
ThanksFirst of all you have to use the proper names otherwise we dont know what you want. "enterprise manager no server explorer"

ok that was my anal retentive dba!!!
now

Books online {Documenting and Scripting Databases}

at the bottom of this doc are instructions on how to do it.|||First of all you have to use the proper names otherwise we dont know what you want. "enterprise manager no server explorer"

ok that was my anal retentive dba!!!
now

Books online {Documenting and Scripting Databases}

at the bottom of this doc are instructions on how to do it.

Ill be more clear, Im Using visual studio 2003, In my server explorer window, when I right click on my DB the "generate create script" option is greyed out. I would like to know why its greyed out?
Im guessing by your answer that this faeture is only available on "enterprise manager" edition? Can someone please confirm this for me?
Thankyou|||first of all sorry i thought that you were in the SQL tool directly , it didnt occur to me that you were in VS7

nope, object scripting is a feature that is avilable in every version of SQL Server. this might be a specific trait of VS7 and i dont currently have it installed anywhere to check.
sorry

RDjabarov can help here, he uses VS7