In this course we’ll explore SQL Server’s support for XML and how it’s improved since being introduced in SQL Server 2000. We’ll discuss SQL Server’s native XML data type—how to declare it as a variable or table column, how it differs from other data types, and how to load data into it using SELECT…FOR XML and the OPENROWSET function. Next you’ll learn the importance of indexing XML columns and that SQL Server supports multiple types of XML indexes including primary, secondary, and the Selective XML index. Then we’ll talk about XML Schemas—how they’re used to validate XML documents, SQL Server’s support for Lax Validation, how to register XML schemas and associate them with XML columns for validation. You’ll learn how to use the XML data type’s native XQuery methods as well as an introduction to FLWOR (flower) expressions. Finally, we’ll wrap up with some best practices and points to consider when you’re deciding if storing data as XML is an appropriate solution for your database application.
This course assumes that you have a basic familiarity with the concept of relational databases and a basic understanding of what SQL Server is and the high-level tools in it, as well as how to create and manage objects using Management Studio. You should also have a basic understanding of how SQL Server implements security, including its authentication and authorization schemes, and how to assign permissions on securable objects to principals. You should know the fundamentals of Transact-SQL to write queries to retrieve and update data, and how to execute scripts using the query editor in Management Studio. It will be very helpful, but not absolutely necessary, to have experience with .NET development using Visual Studio 2010 or 2012 for the portions of the course that deal with SQLCLR development. The .NET code included in this course is written in C#, but if you prefer Visual Basic it should be fairly easy to convert the code.