Answer simple quiz at the end of the blog post and -
Every day one winner from India will get Joes 2 Pros Volume 5.
Every day one winner from United States will get Joes 2 Pros Volume 5.
Shredding XML
Our introduction to XML in the last 3 days of posts thus far has focused on seeing tabular data taken from SQL Server and streamed into well-formed XML instead of the rowset data we typically work with. The next two posts will focus on the reverse process. Our starting point will be data which is already in XML and which we will turn into table data, or which we will query in order to answer questions.
Our previous posts focused on streaming data into XML and we produced XML using the modes Raw, Auto, and Path. We used familiar data from the JProCo database (Employee, Location, Grant, and Customer data). We refined and manipulated our XML queries in order for the XML result to appear according to our precise specifications.

Operations which parse and consume XML data are known collectively by the term shredding XML. The next few posts will focus on the steps to prepare an XML stream so you can turn it into a table or some other tabular result set. XML is case-sensitive so in order for your examples and exercises to run properly be sure that your XML fragments precisely match the figures with respect to uppercase and lowercase.
Consuming XML
Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML. Before you can shred your XML, you must first prepare it. Preparing XML for SQL means storing the XML in a memory space where a query can retrieve and make use of the data. SQL Server 2008 provides native XML support to make streaming and shredding XML more robust.

Think of XML as a big meal for SQL. While we essentially added just one line of code to our Select query to turn tabular data into an XML document, going the other direction is more complex. Behind the scenes, SQL Server uses additional memory when consuming XML. Our preparation will include a step to parse and store the XML document in memory. And the same way a big feast requires additional cleanup, we must include a step to remove the XML document from the memory cache once it is no longer needed.
Now that we understand the essential rules and components of well-formed XML documents, we will turn our attention toward consuming XML data. In the next posts we will see an advanced method (nodes) for shredding XML. Right now we want you to be familiar with the terms used when going back and forth from SQL to XML.

Note: If you want to setup the sample JProCo database on your system you can watch this video. For this post you will want to run the SQLInteropChapter1.0Setup.sql script from Volume 5.
Question 33
What process will transform XML data to a rowset?
- Shredding
- Retrieving
Rules:
Please leave your answer in comment section below with correct option, explanation and your country of resident.
Every day one winner will be announced from United States.
Every day one winner will be announced from India.
A valid answer must contain country of residence of answerer.
Please check my facebook page for winners name and correct answer.
Every day one winner from India will get Joes 2 Pros Volume 5.
Every day one winner from United States will get Joes 2 Pros Volume 5.
The contest is open till next blog post shows up at http://blog.sqlauthority.com which is next day GTM+2.5.
Reference: Pinal Dave (http://blog.SQLAuthority.com)












Correct answer is Option #1, Shredding
Thanks.
Country – India
Correct Answer is # 1.
1. Shredding
Streaming – Converting SQL Server Table Data into XML Format.
Shredding – Converting XML Data into SQL Server Tabular Result Set.
Operations which parse and consume XML data are known collectively by the term shredding XML.
Turning XML into another data format (e.g., into a SQL Server table) that process is called shredding XML.
Preparing XML for SQL means storing the XML in a memory space where a query can retrieve and make use of the data.
SQL Server 2008 provides native XML support to make streaming and shredding XML more robust.
Gopalakrishnan Arthanarisamy
Unisys, Bangalore, India.
The correct answer is #1 – Shredding.
Good article, I’m looking forward for the next one
I am from USA
Transformation from Xml Data to Rowset is called shredding XML.
Country-India
Hi,
Option 1 is correct as its mentioned:
Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML.
Thanks
Sudhir Chawla
New Delhi, India
the correct answer is Option 1,i.e.
1. Shredding
as explained by you in this post…
India
Correct answer is No. 1: shredding XML is the process to turn XML into another data format (e.g., into a SQL Server table).
Rene Castro
El Salvador
Correct Answer is Option 1 as
1. Shredding
because anytime that convert XML into another data format that process is called shredding XML.
Varinder (India)
Correct answer is option #1.
1.Shredding
New Delhi
India
The Correct Answer option : 1 . Shredding
XML data turn into another data format (e.g., into a SQL Server table) that process is called shredding.
Nikhildas
Cochin
INDIA
Answer is option #1 -shredding
Kerala , India
Correct Answer : Option 1
What process will transform XML data to a rowset?
1.Shredding
Anytime you turn XML into another data format (like SQL) that process is called shredding XML
Chennai, TamilNadu, India
Answer is:
1.Shredding
Vinay,
Pune, India
Question 33
Ans : #1 — Shredding
Chennai, INDIA
The answer is #1- Shredding, where we convert XML into another formats (parse and consume it)
Thanks
-Ankit (Hyderabad)
Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML
this line clearly shows that the correct option is
1> i.e shredding
Answer is Option :: 1
The correct answer to this question is option 1
That is Shredding
Mahmad Khoja
Country : INDIA
Correct Answer is # 1.
1. Shredding
Thanks and regards
RIYAS.V.K,India
The correct answer is option1 Shredding.
from hyderabad,India.
Ans: 1.shredding
Operations which parse and consume XML data are known collectively by the term shredding XML.
Partha,
India
Correct answer is #1 – Shredding.
These series of posts on XML are nothing short of a goldmine of introductory learning material. Excellent stuff!
Country of residence: India
Correct Option is #1
Explanation :
The Process of Parsing the xml and load it into sql table is called xml shredding,for which we should focus on case sensitivity of xml elements with sql columns and need to store it into cache.
Vishal Patwardhan
Indore(India)
Correct Answer is 1.
1. Shredding
Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML or in other words Operations which parse and consume XML data are known collectively by the term shredding XML.
Streaming – Converting SQL Server Table Data into XML Format.
Shredding – Converting XML Data into SQL Server Tabular Result Set.
Thanks,
Geetanjali Agarwal
India, Noida
option one is correct that is shredding
new delhi(india)
Answer is option 1> Shredding
Madhusmita (India)
Correct answer is option 1.
When we convert the xml data into another format the term is called Shredding.
When we convert the data in sql server table into xml format that term is called Streaming.
India
Hi
Correct ans is 1st Shredding,
Because to transfer xml data into another data format is known as shredding.
I am from india.
Correct answer is option 1:
1.Shredding
City: Baroda
Country: India
Thanks
GurjitSingh
Correct answer is Option #1, Shredding
The process that turn XML into another data format (e.g., into a SQL Server table) is called shredding XML.
Correct answer is Option #1, Shredding
The process that turn XML into another data format (e.g., into a SQL Server table) is called shredding XML.
SIJIN KUMAR V P
INDIA
Hi
The correct answer is option 1) Shredding
XML shredding is the process of consuming XML data and parsing out the content to scalar elements.
WE can use nodes() to achieve this.
And if the data is huge, to improve the performance – having typed the XML using a schema and created an XML Index will give a performance improvement.
Thanks & Regards
Santosh.S
Bangalore,India
Hi,
As description given “Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML.”
#Option 1 is the correct Answer “Shredding”.
Thanks…
Rajneesh Verma
(INDIA)
The correct answer is:
1. Shredding
Sudeepta,
India.
The correct answer is #1 – Shredding.
Deepali Bhende
INDIA
[...] Q 33) SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Shredding XML – Day 33 of 35 [...]
Shredding is the right answer.
Richa,
USA
The correct option is 1.Shredding
(Sale, Nigeria )
Option 1
1.Shredding
Country:India
Hi Sir,
Option 1 Shredding is the right answer
As said in the blog above “Operations which parse and consume XML data are known collectively by the term shredding XML”
shredding refers to extracting relevant data out of hierarchical XML and putting it into flat relational storage.
Regards,
P.Anish Shenoy,
INDIA, Bangalore, Karnataka
The correct answer is:
1. Shredding
Hiren Bavishi
India.
ANS : 1
(1) Shredding
Explanation
==========
Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML
Mitesh Modi
(India)
Ans: 1
1. Shredding
:India
How to achieve this :
————————————————————-
Declare @testXml xml ;
select @testXml =
(
select top(10) CustomerID, CustomerName, GeographyID from CustomersDetails
for xML path(‘Customer’), root(‘CustomerInformation’)
)
—————————
select
testXmlTable.value(‘CustomerID[1]‘, ‘varchar(7)’) AS CustomerID
,testXmlTable.value(‘CustomerName[1]‘, ‘varchar(100)’) AS CustomerName
FROM @testXml.nodes(‘//Customer’) AS R(testXmlTable)
————————————————————————————
————————————————————————————
if in your production database you already have XML column and want to perform Shredding on that use the “CROSS APPLY”
e.g.
select top(10)
testXml.value(‘cdm_ID[1]‘,’varchar(7)’) AS CustomerID
,testXml.value(‘cdm_Name[1]‘, ‘varchar(7)’) AS CustomerName
from CustomersDetails
CROSS APPLY CustomerXml.nodes(‘//dtCustomerDetails’) AS R(testXml)
Correct Answer # 1
1. Shredding
Alpesh Gorasia
(India)
Nice article: Correct answer is 1 – shredding.
Is your competition open to UK entires?
The correct answer for the above question is Option #1 – Shredding.
The process of converting XML data into a format that can be used by a relational database is called ‘Shredding”, or decomposition. One can either use the NODES method on an XML data type or, from a Document Object Model (DOM), use the OpenXML function. OpenXML is retained in SQL 2005, but the NODES method is generally preferable because of its simplicity and performance.
Diljeet Kumari
Country : INDIA
Hi,
The correct Answer is Option 1 i.e. Shredding
Explanation: Operations which parse and consume XML data are known collectively by the term shredding XML.
Thanks,
Hema Chaudhry
Delhi, India
The correct answer is option – 1 . Shredding
Sushant Kumar Pradhan
Technical Architect, Wipro Technologies
India
The correct answer is:
1. Shredding
Gourav Rampal
Chandigarh,India
Correct Answer is
1: Shredding
you turn XML into another data format that process is called shredding XML.XML support to make streaming and shredding XML more robust.
Preparing XML for SQL means storing the XML in a memory space where a query can retrieve and make use of the data.
Vishal
India
The correct answer is #1 – Shredding
Regards
Rajesh
From india
Correct answer is option 1 Shredding
Robin Thomas
India
]
Option 1, Shredding
Matt Nelson, USA
Answer is 1. Shredding
Shredding is preparing an XML stream so itcan be turned it into a table or some other tabular result set.
Looking forwared to learning more.
Deb
USA
Correct answer is option 1 shredding. Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML
As you have already said above : Anytime you turn XML into another data format (e.g., into a SQL Server table) that process is called shredding XML.
Correct Answer is 1 – Shredding
Ishan Shah,
Gandhinagar,
India
The answer is option #1 Shredding.
Ramdas, NC
USA
Hi Pinal,
Challenge:
Question 33
What process will transform XML data to a rowset?
1. Shredding
2. Retrieving
Correct Answer:
The correct choice is #1: Shredding
Explanation:
Shredding is the process of parsing, consuming and transforming XML data into format suitable for inserting the data into SQL Server.
Country:
United States
Thanks for the knowledge!
Regards,
Bill Pepping
Option 1 –> Shredding
Kevin Scharnhorst
United States
Option 1 is the correct answer.
Country: United States
The correct option for the above question is Option 1 ) Shredding
Shredding process will transform XML data to a rowset.
AS very well explained by you.
Dilip Kumar Jena
Country : INIDA
1.Shredding
Gordon Kane
Allen TX
USA
answer is option 1:Shredding
Thanks
Shekhar Bahuguna
Delhi India
Answer is Option 1: Shredding
Thanks Mr Pinal for this wonderful series. I have never worked with XML data in SQL server and thought of it as a very complex topic. But after reading your posts on XML it is pretty clear to me now.
Thanks
Nikul, USA
Shredding
USA
A.) 1.Shredding
Winner from USA: Bill Pepping
Winner from India: Kewal Krishan Khanna
I thank you all for participating here. The permanent record of this update is posted on facebook page.
correct answer is “Shredding” which is first option.
Shredding is the process of transforming xml data into another format.
Hi Pinal,
whenever a transaction log is full, what is the primary step do we need to take inorder to continue the further transactions on the database?
please give reply to my question as soon as possible.
[...] Q 33) SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Shredding XML – Day 33 of 35 [...]
[...] Server Interview Questions and Answers ISBN: 1466405643 Page#137-139 SELECT * FROM XML Shredding XML Validate an XML document in TSQL using XSD Simple Example of Reading XML File Using T-SQL Simple [...]
[...] SQL Joes 2 Pros Development Series – Shredding XML [...]