Learn your way! Get started

SQL 2014 Developer, Part 13 of 13: Working with XML

with expert Frank Tillinghast


Watch trailer


Course at a glance

Included in these subscriptions:

  • Dev & IT Pro Video
  • Dev & IT Pro Power Pack

Release date 6/5/2015
Level Advanced
Runtime 1h 13m
Closed captioning Included
Transcript Included
eBooks / courseware Included
Hands-on labs Included
Sample code Included
Exams Included


Enterprise Solutions

Need reporting, custom learning tracks, or SCORM? Learn More



Course description

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.

Prerequisites

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.

Learning Paths

This course will help you prepare for the following certifications and exams:
MCSE: Business Intelligence
MCSA: SQL Server 2012/2014
MCSE: Data Platform
70-464: Developing Microsoft SQL Server 2012/2014 Databases
70-461: Querying Microsoft SQL Server 2012/2014

This course is part of the following LearnNowOnline SuccessPaths™:
SQL Server Developer

Meet the expert

Frank Tillinghast is a senior consultant with MTOW Software Solutions. He is a Microsoft Certified Solution Developer and has been developing applications for over 15 years. Most of his time is spent consulting for companies nationwide with troubled projects or mentoring projects to successful completion. When he is not developing software or mentoring clients, Frank is teaching other developers. He has taught thousands of application developers how to create business solutions with Visual Studio .NET. VB.NET, ASP.NET, Visual C#, and SQL Server.

Course outline



Working with XML

XML Data Type (28:23)
  • Introduction (00:40)
  • The XML Data Type (00:33)
  • Declaring XML Objects (02:32)
  • Demo: XML Type Variable (02:57)
  • Loading Data into XML Objects (00:37)
  • Using SELECT...FOR XML (01:44)
  • Bulk Loading (01:38)
  • Demo: Direct Assignment (01:08)
  • Demo: FOR XML (01:32)
  • Demo: Bulk Loading (02:13)
  • Indexing XML Columns (00:42)
  • Primary XML Indexes (01:17)
  • Secondary XML Indexes (01:38)
  • Selective XML Indexes (03:24)
  • Demo: Indexing XML (05:06)
  • Summary (00:34)
XML Schemas (17:32)
  • Introduction (00:37)
  • XML Schema Collections (01:01)
  • Typed and Untyped XML (01:23)
  • Schema Basics (00:37)
  • Demo: XML Schema (00:53)
  • Lax Validation (01:37)
  • Registering Schemas (01:27)
  • Demo: Registering Schemas (02:55)
  • Viewing Stored Schemas (01:21)
  • sys.xml_schema (01:43)
  • xml_schema_namespace (01:13)
  • Demo: Catalog Views (02:17)
  • Summary (00:22)
Querying XML (20:18)
  • Introduction (00:31)
  • Querying XML (00:47)
  • Using XQuery (01:10)
  • XQuery Methods (02:18)
  • XQuery FLWOR Statement (01:04)
  • Demo: XQuery Methods (02:31)
  • Demo: FLWOR Expressions (02:39)
  • FOR XML (00:49)
  • Demo: FOR XML (03:32)
  • OPENXML (01:45)
  • Demo: OPENXML (02:39)
  • Summary (00:25)
Best Practices (07:43)
  • Introduction (00:34)
  • Best Practices (00:36)
  • Relational vs. XML Data Model (01:40)
  • Reasons to Index XML Columns (02:55)
  • Querying (01:22)
  • Summary (00:34)