Book Image

SQL Server 2016 Developer's Guide

By : Miloš Radivojević, Dejan Sarka, William Durkin
Book Image

SQL Server 2016 Developer's Guide

By: Miloš Radivojević, Dejan Sarka, William Durkin

Overview of this book

Microsoft SQL Server 2016 is considered the biggest leap in the data platform history of the Microsoft, in the ongoing era of Big Data and data science. This book introduces you to the new features of SQL Server 2016 that will open a completely new set of possibilities for you as a developer. It prepares you for the more advanced topics by starting with a quick introduction to SQL Server 2016's new features and a recapitulation of the possibilities you may have already explored with previous versions of SQL Server. The next part introduces you to small delights in the Transact-SQL language and then switches to a completely new technology inside SQL Server - JSON support. We also take a look at the Stretch database, security enhancements, and temporal tables. The last chapters concentrate on implementing advanced topics, including Query Store, column store indexes, and In-Memory OLTP. You will finally be introduced to R and learn how to use the R language with Transact-SQL for data exploration and analysis. By the end of this book, you will have the required information to design efficient, high-performance database applications without any hassle.
Table of Contents (21 chapters)
SQL Server 2016 Developer's Guide
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
12
In-Memory OLTP Improvements in SQL Server 2016

Programming


The programming landscape of SQL Server has continued to improve in order to adopt newer technologies over the years. SQL Server 2016 is no exception to this: there have been some long awaited general improvements and also some rather revolutionary additions to the product that change the way SQL Server may be used in future projects. This section will outline what programming improvements have been included in SQL Server 2016.

Transact SQL enhancements

The last major improvements in the T-SQL language allowed for better processing of running totals and other similar window functions. This was already a boon and allowed developers to replace arcane cursors with high performance T-SQL. These improvements are never enough for the most performance-conscious developers among us, and as such there were still voices requesting further incorporation of the ANSI SQL standards into the T-SQL implementation.

Notable additions to the T-SQL syntax include the ability to finally split comma separated strings via a single function call STRING_SPLIT() instead of the previous "hacky" implementations using loops, functions, XML conversions or even the CLR.

The sensible opposing syntax for splitting strings is a function to aggregate values together: STRING_AGG() returns a set of values in a comma separated string. This replaces similarly "hacky" solutions using the XML data type or one of a multitude of looping solutions. Each improvement in the T-SQL language further extends the toolbox that we as developers possess in order to manipulate data inside SQL Server.

Note

Further details on T-SQL Enhancements can be found in Chapter 4, Transact-SQL Enhancements.

JSON

It is quite common to meet developers outside the Microsoft stack who look down on products released from Redmond. Web developers in particular have been critical of the access to the latest data exchange structures, or rather lack of it. JSON has become the de facto data exchange method for the application development world. It is similar in structure to the previous "cool-kid" XML, but for reasons beyond the scope of this book, JSON has overtaken XML in general programming projects and is the expected payload for application and database communications. Microsoft has included JSON as a possible data exchange data type in SQL Server 2016 and provided a set of functions to accompany the data type.

Note

Further details on JSON can be found in Chapter 5, JSON Support in SQL Server.

In-Memory OLTP

In-Memory OLTP (codename Hekaton) was introduced in SQL Server 2014. The promise of ultra-high performance data processing inside SQL Server was a major feature when SQL Server 2014 was released. As expected with a newly implemented feature, there were a wide range of limitations in the initial release and this prevented many customers from being able to adopt the technology. With SQL Server 2016 a great number of these limitations have been either raised to a higher threshold or completely removed. In-Memory OLTP has received the required maturity and extension in its feature set to make it viable for prime production deployment. Chapter 11, Introducing SQL Server In-Memory OLTP, of this book will show an introduction to In-Memory OLTP, explaining how the technology works under the hood and how the initial release of the feature works in SQL Server 2014. Chapter 12, In-Memory OLTP Improvements in SQL Server 2016, will build on the introduction and explain how the feature has matured and improved with the release of SQL Server 2016.

Note

Further details on In-Memory OLTP can be found in Chapter 11Introducing SQL Server In-Memory OLTP and Chapter 12In-Memory OLTP Improvements in SQL Server 2016.

SQL Server tools

Accessing or managing data inside SQL Server and developing data solutions are two separate disciplines, each with their own specific focus on SQL Server. As such, Microsoft has created two different tools, each tailored towards the processes and facets of these disciplines.

SQL Server Management Studio (SSMS), as the name suggests, is the main management interface between DBAs/Developers and SQL Server. The studio was originally released with SQL Server 2005 as a replacement and consolidation of the old Query Analyzer and Enterprise Manager tools. As with any non-revenue generating software, SSMS received less attention over the years than the database engine, with limitations and missing tooling for many of the newer features in SQL Server. With SQL Server 2016 the focus inside Microsoft has been shifted and SSMS has been de-coupled from the release cycle of SQL Server itself. This decoupling allows both SSMS and SQL Server to be developed without having to wait for each other or for release windows. New releases of SSMS are created on top of more recent versions of Visual Studio and have seen almost monthly update releases since SQL Server 2016 was released to the market.

SQL Server Data Tools (SSDT) is also an application based on the Visual Studio framework. SSDT is focused on the application/data development discipline. SSDT is much more closely aligned with Visual Studio in its structure and the features offered. This focus includes the ability to create entire database projects and solution files, an easier integration into source control systems, the ability to connect projects into automated build processes, and generally offering a developer-centric development environment with a familiarity with Visual Studio. It is possible to design and create solutions in SSDT for SQL Server using the Relational Engine, Analysis Services, Integration Services, Reporting Services, and of course, for Azure SQL Database.

Note

Further details for SQL Server Tools can be found in Chapter 3, SQL Server Tools.

This concludes the overview of programming enhancements inside SQL Server 2016. The improvements outlined are all solid evolutionary steps in their respective areas. New features are very welcome and allow us to achieve more, while requiring less effort on our side. The In-Memory OLTP enhancements are especially positive, as they now expand on the groundwork laid down in the release of SQL Server 2014. Read the respective chapters to gain a deeper insight into how these enhancements can help you.