17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 16: A Brief XML Primer<br />

<strong>SQL</strong> <strong>Server</strong> strips out any whitespace between tags, so if you create a schema collection with all sorts of<br />

pretty indentations for readability, <strong>SQL</strong> <strong>Server</strong> will remove them for the sake of efficient storage.<br />

Creating, Altering, and Dropping XML Schema Collections<br />

The CREATE, ALTER, and DROP notions for XML schema collections work in a manner that is mostly consistent<br />

with how other such statements have worked thus far in <strong>SQL</strong> <strong>Server</strong>. We’ll run through them<br />

here, but pay particular attention to the ALTER statement, as it is the one that has a few quirks we<br />

haven’t seen in other ALTER statements we’ve worked with.<br />

CREATE XML SCHEMA COLLECTION<br />

490<br />

Again, note that the default number of characters returned for text results in Management<br />

Studio is only 256 characters. If you’re using text view, you will want to go<br />

Tools ➪ Options ➪ Query Results ➪ <strong>SQL</strong> <strong>Server</strong> ➪ Results to Text and change the<br />

maximum number of characters displayed.<br />

Again, the CREATE is your typical CREATE syntax that we’ve seen<br />

throughout the book, and uses the AS keyword we’ve seen with stored procedures, views, and other less<br />

structured objects:<br />

CREATE XML SCHEMA COLLECTION [.] <br />

AS { | }<br />

So if, for example, we wanted to create an XML schema collection that is similar to the Production<br />

.ManuInstructionsSchemaCollection collection in AdventureWorks<strong>2008</strong>, we might execute something<br />

like the following:<br />

CREATE XML SCHEMA COLLECTION ProductDescriptionSchemaCollectionSummaryRequired<br />

AS<br />

‘<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!