Наслаждайтесь миллионами электронных книг, аудиокниг, журналов и других видов контента в бесплатной пробной версии

Только $11.99 в месяц после пробной версии. Можно отменить в любое время.

XML and JSON Recipes for SQL Server: A Problem-Solution Approach
XML and JSON Recipes for SQL Server: A Problem-Solution Approach
XML and JSON Recipes for SQL Server: A Problem-Solution Approach
Электронная книга523 страницы2 часа

XML and JSON Recipes for SQL Server: A Problem-Solution Approach

Автор Alex Grinberg

Рейтинг: 0 из 5 звезд


Читать отрывок

Об этой электронной книге

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
Who This Book Is For
Database administrators, .NET developers, business intelligence developers, and other professionals who want a deep and detailed skill set around working with XML and JSON in a SQL Server database environment. Web developers will particularly find the book useful for its coverage of transforming database result sets into JSON text that can be transmitted to front-end web applications. 
Дата выпуска18 дек. 2017 г.
XML and JSON Recipes for SQL Server: A Problem-Solution Approach
Читать отрывок

Связано с XML and JSON Recipes for SQL Server

Похожие электронные книги

Похожие статьи

Отзывы о XML and JSON Recipes for SQL Server

Рейтинг: 0 из 5 звезд
0 оценок

0 оценок0 отзывов

Ваше мнение?

Нажмите, чтобы оценить

Отзыв должен содержать не менее 10 слов

    Предварительный просмотр книги

    XML and JSON Recipes for SQL Server - Alex Grinberg

    Part IXML in SQL Server

    ©  Alex Grinberg 2018

    Alex GrinbergXML and JSON Recipes for SQL Serverhttps://doi.org/10.1007/978-1-4842-3117-3_1

    1. Introducing XML

    Alex Grinberg¹ 


    Richboro, Pennsylvania, USA

    Welcome and thank you for reading XML and JSON Recipes for SQL Server. In the modern world of information technology, keeping data stored and manipulated reliably and efficiently is one of the first priorities. In the last decade, SQL Server has evolved into a sophisticated Enterprise RDBMS tool, and it is still growing by providing more functionalities to store and manipulate data reliably. eXtensible Markup Language (XML) is one of the technologies that SQL Server implements not only for data manipulation but also for many internal usages, such as Execution Plans, Extended Events, DDL trigger Eventdata() function, and behind construction for SQL Server Business Intelligence Tools (SSIS, SSRS, SSAS). In Part 1 of this book, I will cover and provide the recipes on how to work with the SQL Server XML data type; discuss and demonstrate real type scenarios to load, build, and shred the XML; and present how daily tasks can be simplified by implementing XML technologies. In this book, I will primarily be focusing on technology rather than theory.

    Stepping into XML

    To work with XML, we need to understand this technology, especially for SQL Server. XML is similar to HTML (Hypertext Markup Language). XML and HTML contain markup elements to describe the contents of the file or page for HTML. The big difference between them is that HTML contains predefined elements (tags), while XML’s elements and attributes are not predefined and based on described data within the files.

    Several more important differences between HTML and XML:

    XML is key sensitive while HTML is not.

    XML opened element must be closed. HTML can have an opened element without a closed element. For example, Display Text will compile for HTML and will return an error for XML .


    SQL Server, by default, is not case sensitive. However, XML is case sensitive, and all XQuery Path Language (XPath) functions and node tests are case sensitive (all lowercase). They will return an error when entered with any case other than lowercase.

    Sample Database

    All code samples for Part I in this book utilize the SQL Server AdventureWorks sample database, unless otherwise specified and referenced separately in the text. The AdventureWorks database URL is https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks2014 . I would highly recommend downloading and installing the AdventureWorks sample database to run the samples presented.

    Understanding XML

    Before working with XML, we need to explain the difference between the two types of node-centric XML formats supported by SQL Server:





    Both elements and attributes can contain data. However, SQL Server has specialized functionality and features for each format generating or shredding (shredding is a process to convert XML into rows-columns format) attribute-centric or element-centric data. In the element-centric format, values are contained within the opening and closing tags of an element, for example, . The attribute