XML and JSON Recipes for SQL Server

A Problem-Solution Approach

  • Alex Grinberg

Table of contents

  1. Front Matter
    Pages i-xxiii
  2. XML in SQL Server

    1. Front Matter
      Pages 1-1
    2. Alex Grinberg
      Pages 3-22
    3. Alex Grinberg
      Pages 23-51
    4. Alex Grinberg
      Pages 53-99
    5. Alex Grinberg
      Pages 101-134
    6. Alex Grinberg
      Pages 135-156
    7. Alex Grinberg
      Pages 157-183
    8. Alex Grinberg
      Pages 185-218
  3. JSON in SQL Server

    1. Front Matter
      Pages 219-219
    2. Alex Grinberg
      Pages 221-244
    3. Alex Grinberg
      Pages 245-267
    4. Alex Grinberg
      Pages 269-285
  4. Back Matter
    Pages 287-289

About this book


Quickly find solutions to dozens of common problems encountered while using XML and JSON features that are built into SQL Server. Content is presented in the popular problem-solution format. Look up the problem that you want to solve. Read the solution. Apply the solution directly in your own code. Problem solved!

This book shows how to take advantage of XML and JSON to share data and automate tasks. JSON is commonly used to move data back and forth between the database and front-end applications, often running in a browser. This book shows all you need to know about transforming query results into JSON format, and back again. Also covered are the processes and techniques for moving data into and out of XML format for business intelligence and other purposes, such as when transferring data from a reporting system into a data warehouse, or between different database brands such as between SQL Server and Oracle.

Microsoft intensively implements XML in SQL Server, and in many related products. Execution plans are generated in XML format, and this book shows you how to parse those plans and automate the detection of performance problems. The relatively new Extended Events feature writes tracing data into XML files, and the recipes in this book help in parsing those files. 

XML is also used in SQL Server's BI tool set, including in SSIS, SSR, and SSAS. XML is used in many configuration files, and is even behind the construction of DDL triggers. In reading this book you’ll dive deeply into the features that allow you to build and parse XML, and also JSON, which is a specific format of XML used to transmit objects in a web-friendly format between a database and its front-end applications.

What You Will Learn:
  • Build XML and JSON objects in support of automation and data transfer
  • Import and parse XML and JSON from operating system files
  • Build appropriate indexes on XML objects to improve query performance
  • Move data from query result sets into JSON format, and back again
  • Automate the detection of database performance problems by querying and parsing the database’s own execution plans
  • Replace external and manual JSON processes with SQL Server's internal, JSON functionality


T-SQL .NET JSON XML SQL Server 2016 Business Intelligence SQL Server Objects XPath

Authors and affiliations

  • Alex Grinberg
    • 1
  1. 1.RichboroUSA

Bibliographic information