T-SQL window functions have been a fantastic addition to the T-SQL language. In this article, Kathi Kellenberger reviews how optimizations available in SQL Server 2019 can improve the performance of these functions.… Read more
You have many options when exporting data from a database. In this article, Phil Factor compares several methods including XML and array-in-array JSON for speed and file size.… Read more
Now that SQL Server 2019 is on the way, it’s time to start learning about the new capabilities. In this article, Greg Larson tests the new APPROX_COUNT_DISTINCT function for performance and accuracy.… Read more
JSON is a viable option for transferring data between systems. It has the ability to include schema information along with the data which is an advantage over CSV files. In this article, Phil Factor demonstrates how he takes advantage of JSON when exporting or importing tables. … Read more
T-SQL window functions, introduced in 2005 with enhancements in 2012, are great additions to the T-SQL language. In this article, Kathi Kellenberger explains what you need to know to get good performance when using these functions.… Read more
T-SQL window functions were introduced in 2005 with more functionality added in 2012. Many database professionals are not aware of these useful functions. In this article, Kathi Kellenberger provides a quick overview of just what a window function is as well as examples of each type of function.… Read more
In-Memory OLTP was introduced with SQL Server 2014 as a way to improve transaction performance. There are several scenarios that are not supported, such as some data types, and Darko Martinović describes the issues and provides workarounds. He also has provided a tool to assist in migrating disk-based tables to In-Memory optimized tables.… Read more
Microsoft introduced native support for JSON in SQL Server in version 2016. In this article, Phil Factor shows how to import JSON documents into to SQL Server database tables, even if there is a bit of complexity in the original data.… Read more
In the final article of this series, Robert Sheldon shows how to move from a relational structure to a graph structure using the Graph Database feature.… Read more
The Graph Database feature, new with SQL Server 2017, can be used to represent hierarchies. In this article of the series, Robert Sheldon demonstrates how to represent hierarchies in data with complex relationships.… Read more
SQL Server has a couple of different ways to represent hierarchies, but they do not allow storing any additional information that is important to the relationship between objects. In this article, Phil Factor explains how to use closure tables to overcome this deficiency.… Read more
Modifying data in Graph Database tables is similar to working with traditional tables, but there are several things to consider. Robert Sheldon explains how to insert, update, and delete rows of Graph Database tables and explains how to use several new helper functions. … Read more
Some time ago, Phil Factor wrote his booklet 'SQL Code Smells', collecting together a whole range of SQL Coding practices that could be considered to indicate the need for a review of the code. It was published as 119 code smells, even though there were 120 of them at the time. Phil Factor has continued to collect them and the current state of the art is reflected in this article. SQL Prompt is committed to cover as many as possible of them. Phil has also updated his book which you can download here.… Read more
Along with Graph Databases, Microsoft has introduced the new MATCH function for querying them. Robert Sheldon explains how to use the new function.… Read more
T-SQL does not have an easy way to transpose a row and a column. Of course, there is the PIVOT statement, but it doesn’t quite accomplish the task. In this article, Darko Martinovic shares another method using a SQLCLR stored prodedure.… Read more
SQL Server 2017 now includes a new feature to represent complex relationships in data called Graph Databases. Robert Sheldon introduces Graph Databases in the first article of this new series. … Read more
Stored procedures, for example, are very easy to document. The comment block at the beginning stays with the code and a CREATE or ALTER script contains everything to reproduce the proc. SQL Server tables, however, are more difficult to document. You can use Extended Properties to document columns and constraints, but working with Extended Properties is difficult at best. Phil Factor demonstrates ways to easily add Extended Properties to your build scripts. … Read more
Joe Celko reminisces about the origins of databases and one of the early pioneers, Charles Bachman. He explains how pointer chains were used to traverse data in the NDL standard and referential integrity that we use today.… Read more
There are several methods to pivot, or transpose, data in T-SQL, but most are difficult to understand and write. Phil Factor demonstrates how to take advantage of JSON support, introduced with SQL Server 2016, to create a function that makes pivoting data simple.… Read more
Writing aggregate queries is one of the most important tasks for anyone working with T-SQL. Determining the expressions required in the GROUP BY clause is not that difficult, but what do you do if you need to include different combinations of group by expressions in the same result set? Alfonso demonstrates how to use the GROUPING SETS operator to accomplish this task.… Read more