XML and JSON Recipes for SQL Server: A Problem-Solution Approach
Автор Alex Grinberg
()
Об этой электронной книге
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
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.
Связано с XML and JSON Recipes for SQL Server
Похожие электронные книги
Contagious: Why Things Catch On Рейтинг: 4 из 5 звезд4/5Learn SQL Server Administration in a Month of Lunches Рейтинг: 0 из 5 звезд0 оценокSet Up and Manage Your Virtual Private Server: Making System Administration Accessible to Professionals Рейтинг: 0 из 5 звезд0 оценокUsing and Administering Linux: Volume 3: Zero to SysAdmin: Network Services Рейтинг: 0 из 5 звезд0 оценокPowerShell and Python Together: Targeting Digital Investigations Рейтинг: 0 из 5 звезд0 оценокWebsite Scraping with Python: Using BeautifulSoup and Scrapy Рейтинг: 0 из 5 звезд0 оценокBeginning Microsoft Power BI: A Practical Guide to Self-Service Data Analytics Рейтинг: 0 из 5 звезд0 оценокModern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Рейтинг: 0 из 5 звезд0 оценокThe Robotic Process Automation Handbook: A Guide to Implementing RPA Systems Рейтинг: 0 из 5 звезд0 оценокPractical UI Patterns for Design Systems: Fast-Track Interaction Design for a Seamless User Experience Рейтинг: 0 из 5 звезд0 оценокLearn dbatools in a Month of Lunches: Automating SQL server tasks with PowerShell commands Рейтинг: 0 из 5 звезд0 оценокLearn Windows IIS in a Month of Lunches Рейтинг: 0 из 5 звезд0 оценокEssential Computer Science: A Programmer’s Guide to Foundational Concepts Рейтинг: 0 из 5 звезд0 оценокBeginning C++20: From Novice to Professional Рейтинг: 0 из 5 звезд0 оценокEnterprise DevOps Framework: Transforming IT Operations Рейтинг: 0 из 5 звезд0 оценокEssential ASP.NET Web Forms Development: Full Stack Programming with C#, SQL, Ajax, and JavaScript Рейтинг: 0 из 5 звезд0 оценокWeb-Based Projects that Rock the Class: Build Fully-Functional Web Apps and Learn Through Doing Рейтинг: 0 из 5 звезд0 оценокSQL Primer: An Accelerated Introduction to SQL Basics Рейтинг: 0 из 5 звезд0 оценокPowerShell for Beginners: Learn PowerShell 7 Through Hands-On Mini Games Рейтинг: 0 из 5 звезд0 оценокCRM Fundamentals Рейтинг: 0 из 5 звезд0 оценокBuilding Better PowerShell Code: Applying Proven Practices One Tip at a Time Рейтинг: 0 из 5 звезд0 оценокVisual Studio Code Distilled: Evolved Code Editing for Windows, macOS, and Linux Рейтинг: 0 из 5 звезд0 оценокLearn System Center Configuration Manager in a Month of Lunches: Covers SCCM 1511 and Windows 10 Рейтинг: 0 из 5 звезд0 оценокPowerShell Deep Dives Рейтинг: 0 из 5 звезд0 оценокLeading When You're Not the Boss: How to Get Things Done in Complex Corporate Cultures Рейтинг: 0 из 5 звезд0 оценок
Отзывы о XML and JSON Recipes for SQL Server
0 оценок0 отзывов
Предварительный просмотр книги
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¹
(1)
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 .
Caution
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:
1.
Element-centric
2.
Attribute-centric
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,