Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering SQL Server 2017

You're reading from  Mastering SQL Server 2017

Product type Book
Published in Aug 2019
Publisher Packt
ISBN-13 9781838983208
Pages pages
Edition 1st Edition
Languages
Concepts
Authors (5):
Miloš Radivojević Miloš Radivojević
Profile icon Miloš Radivojević
Dejan Sarka Dejan Sarka
Profile icon Dejan Sarka
William Durkin William Durkin
Profile icon William Durkin
Christian Cote Christian Cote
Profile icon Christian Cote
Matija Lah Matija Lah
Profile icon Matija Lah
View More author details
Toc

Table of Contents (20) Chapters close

Title Page
Copyright Contributors About Packt Preface 1. Introduction to SQL Server 2017 2. SQL Server Tools 3. JSON Support in SQL Server 4. Stretch Database 5. Temporal Tables 6. Columnstore Indexes 7. SSIS Setup 8. What Is New in SSIS 2016 9. Key Components of a Modern ETL Solution 10. Dealing with Data Quality 11. Unleash the Power of SSIS Script Task and Component 12. On-Premises and Azure Big Data Integration 13. Extending SSIS Custom Tasks and Transformations 14. Scale Out with SSIS 2017 1. Other Books You May Enjoy

Retrieving SQL Server data in JSON format

This section explores JSON support in SQL Server with a very common action: formatting tabular data as JSON. In SQL Server 2017, the clause FOR JSON can be used with the SELECT statement to accomplish this. It is analogous to formatting relational data as XML by using the FOR XML extension.

When you use the FOR JSON clause, you can choose between two modes:

  • FOR JSON AUTO: The JSON output will be formatted by the structure of the SELECT statement automatically.
  • FOR JSON PATH: The JSON output will be formatted by the structure explicitly defined by you. With JSON PATH, you can create a more complex output (nested objects and properties).

In both modes, SQL Server extracts relational data defined by the SELECT statement, converts SQL Server data types to appropriate JSON types, implements escaping rules, and finally formats the output according...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}