Used these steps:
SSEUtil -c
> USE "c:\Rich.mdf"
> GO
>!RUN Resume.SQL
//indicates success
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema not shown in list
> USE master
>GO
>SELECT * FROM SYS.XML_SCHEMA_COLLECTIONS
>GO
//schema is shown in the query
It appears that the schema is not added to the desired database, so when I try to use the schema in Visual Studio, the schema does not appear when I connect to the Rich.mdf database. Any ideas on what I am doing wrong or why this might be happening?
Thanks
Kevin
Really strange. Maybe there is some statement in the Resume.SQL that switch database to master when creating the schema?
|||Shouldn't, this is the script file:CREATE XML SCHEMA COLLECTION ResumeXSD AS
N'<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" >
<xs:element name="Name" type="xs:string"></xs:element>
<xs:element name="Objective" type="xs:string"></xs:element>
<xs:element name="Address">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
<xs:element name="Street" type="xs:string"/>
<xs:element name="City" type="xs:string"/>
<xs:element name="StateProv" type="xs:string" />
<xs:element name="Country" type="xs:string" />
<xs:element name="PostCode" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WorkExperience">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="ExpText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Reference">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="RefText" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>'
GO|||Well,
I accomplished my task of adding an XML Schema Collection. I logged into SSMSE and attached the database, then did a USE on the database, pasted SQL file into a new query and it worked.
I did notice after I got his working, that the book instructed me to do this:
CREATE XML SCHEMA COLLECTION ResumeXSD AS <snipped\
but in the sample it uses dbo:
CREATE XML SCHEMA COLLECTION dbo.ResumeXSD AS <snipped\
Maybe I'll try that later and see if it works.
-Kevin
No comments:
Post a Comment