From the course: SQL Server 2014 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Shredding XML

Shredding XML - SQL Server Tutorial

From the course: SQL Server 2014 Essential Training

Start my 1-month free trial

Shredding XML

- In one of the previous sections, we looked at transforming table base data into XML. And now we're gonna look at the opposite. We're start off with XML, and the end product return will be table base data. This process is sometimes called shredding XML. Turning XML into a tabular or object-oriented format, is called shredding. This is a little more complicated than going the other way, So when we went from table data to XML, that was pretty simple. But unfortunately going XML to table data is a little more complicated. I've staged some code for you for this in your exercise files. You'll want to take all of that and copy it into a new query window. And let's talk about it before we run it. The first two lines are just declaring some variables we're going to use later on. Lines four through eight, sets the value of one of those variables to an XML snippet. Some simple XML where we're just defining one Person element. And inside of there, a FirstName and LastName element. Then on line…

Contents