Intro; Table of Contents; About the Author; About the Technical Reviewer; Introduction; Chapter 1: SQL Server Data Types; Numeric Data Types; Character Strings; Binary Data Types; Dates and Times; Miscellaneous Standard Data Types; Summary of Advanced Data Types; Why Is Using the Correct Data Type Important?; Summary; Chapter 2: Understanding XML; Understanding XML; Well-Formed XML; Understanding XSD Schemas; XML Usage Scenarios in SQL Server; Summary; Chapter 3: Constructing XML with T-SQL; Using FOR XML RAW; Using FOR XML AUTO; Using FOR XML PATH; Using FOR XML EXPLICIT; Summary.
Chapter 4: Querying and Shredding XMLQuerying XML; Using exist(); Using value(); Using query(); Using Relational Values in XQuery; FLWOR; Modifying XML Data; Shredding XML; Shredding XML with OPENXML(); Shredding XML with Nodes; Using Schemas; Summary; Chapter 5: XML Indexes; Preparing the Environment; Clustered Indexes; Tables Without a Clustered Index; Tables with a Clustered Index; Clustering the Primary Key; Performance Considerations for Clustered Indexes; Creating a Clustered Index; Primary XML Indexes; Creating Primary XML Indexes; Secondary XML Indexes.
Creating Secondary XML IndexesPerformance Considerations for XML Indexes; Summary; Chapter 6: Understanding JSON; Understanding the JSON Format; JSON vs. XML; JSON Usage Scenarios; n-Tier Applications with Rest APIs; De-Normalizing Data; Config As Code; Analyzing the Log Data; Summary; Chapter 7: Constructing JSON from T-SQL; FOR JSON AUTO; Working with Root Nodes; Working with NULL Values; Using Column Aliases; Automatic Nesting; FOR JSON PATH; Summary; Chapter 8: Shredding JSON Data; OPENJSON() with Default Schema; Shredding a Column; Dynamic Shredding Based on Document Content.
OPENJSON() with Explicit SchemaOPENJSON() with Path Expressions; Shredding Data into Tables; Summary; Chapter 9: Working with the JSON Data Type; Querying JSON Data; Using ISJSON(); Using JSON_VALUE(); Using JSON_QUERY(); Using JSON_MODIFY(); Indexing JSON Data; Summary; Chapter 10: Understanding Spatial Data; Understanding Spatial Data; Spatial Data Standards; Well-Known Text; Well-Known Binary; Spatial Reference Systems; SSMS and Spatial Data; Summary; Chapter 11: Working with Spatial Data; Constructing Spatial Data; Querying Spatial Data; Indexing Spatial Data.
Understanding Spatial IndexesCreating Spatial Indexes; Summary; Chapter 12: Working with Hierarchical Data and HierarchyID; Hierarchical Data Use Cases; Modeling Traditional Hierarchies; Modeling Hierarchies with HierarchyID; HierarchyID Methods; Working with HierarchyID Methods; Using ToString(); Using Parse(); Using GetRoot(); Using GetLevel(); Read() and Write(); Using GetDescendant(); Using GetReparentedValue(); Using GetAncestor(); Using IsDescendantOf(); Indexing HierarchyID Columns; Summary; Index.
0
8
8
8
8
Deliver advanced functionality faster and cheaper by exploiting SQL Server's ever-growing amount of built-in support for modern data formats. Learn about the growing support within SQL Server for operations and data transformations that have previously required third-party software and all the associated licensing and development costs. Benefit through a better understanding of what can be done inside the database engine with no additional costs or development time invested in outside software. Widely used types such as JSON and XML are well-supported by the database engine. The same is true of hierarchical data and even temporal data. Knowledge of these advanced types is crucial to unleashing the full power that's available from your organization's SQL Server database investment. SQL Server Advanced Data Types explores each of the complex data types supplied within SQL Server. Common usage scenarios for each complex data type are discussed, followed by a detailed discussion on how to work with each data type. Each chapter demystifies the complex data and you learn how to use the data types most efficiently. The book offers a practical guide to working with complex data, using real-world examples to demonstrate how each data type can be leveraged. Performance considerations are also discussed, including the implementation of special indexes such as XML indexes and spatial indexes. What You'll Learn: Understand the implementation of basic data types and why using the correct type is so important Work with XML data through the XML data type Construct XML data from relational result sets Store and manipulate JSON data using the JSON data type Model and analyze spatial data for geographic information systems Define hierarchies and query them efficiently through the HierarchyID type.