O'Reilly logo

Microsoft® SQL Server 2008 R2 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using XML Schema Collections

In this section, you define a simple XML schema, add it to a new schema collection stored on the server, and create a table where you can store instances of this schema. You also add a check constraint to ensure that the value of the ProductId attribute of the XML’s root node matches the value of the ProductId column, using the xml data type value() method (discussed later in this chapter, in the section, “The Built-in xml Data Type Methods”). The foreign key constraint you define on ProductId also serves to ensure that both ProductId values reference a primary key value in HumanResources.Product.

The real-world concept behind this sample schema is that it defines groups of customer feedback calls and subsequent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required