Dwain Camps Calculating the Median Value within a Partitioned Set Using T-SQL It is ironic that one of the most essential of statistical aggregations, the median, has been so difficult in the... 17 December 2013 12 min read
Joe Celko Window Functions in SQL SQL's windowing functions are surprisingly versatile, and allow us to cut out all those self-joins and explicit cursors. Joe Celko... 31 October 2013 16 min read
Dwain Camps Calculating Values within a Rolling Window in Transact SQL Before the SQL Window functions were implemented, it was tricky to calculate rolling totals or moving averages efficiently in SQL... 17 October 2013 19 min read
Joe Celko Databases and Dominoes A Dominoes game of Texas 42 inspires Joe to explore unusual uses for check constraints and views. Sometimes, the best... 09 September 2013 14 min read
Dwain Camps Gaps and Islands in SQL Server: Fast Set-Based Solutions Compared Efficient SQL Server solutions to the gaps and islands problem - detecting unbroken sequences and the gaps between them. Covers... 25 July 2013 16 min read
Phil Factor SQL Server ALTER TABLE syntax diagrams The words in the documentation for the ALTER TABLE syntax on MSDN are accurate with forensic precision, but the potentially-useful... 09 July 2013 8 min read
Hugo Kornelis Painless management of a logging table in SQL Server Tables that log a record of what happens in an application can get very large, easpecially if they're growing by... 11 June 2013 26 min read
Phil Factor SQL Server CREATE TABLE syntax diagrams Many of us have seen, on MSDN, the heading 'Syntax', followed by a rash of nested brackets and keywords, enough... 06 June 2013 8 min read
Joe Celko The SQL of Parts Explosions Parts explosions present a classic IT problem. How can one calculate such things as weight or cost of assemblies in... 30 May 2013 11 min read
Robert Sheldon tSQLt Tutorial: Unit Testing SQL Server Databases with Test Cases and Fakes A complete tSQLt tutorial for SQL Server unit testing: setting up the tSQLt framework, creating test classes and test cases,... 08 April 2013 23 min read
Hugh Bin-Haad TSQL Pivot Rotations using only REPLACE Pivoting SQL Server tables is always awkward, even with the PIVOT and UNPIVOT operators. If you want to get the... 01 April 2013 8 min read
Kathi Kellenberger Solving Complex T-SQL Problems, Step-By-Step What should you do if your first, most intuitive solution to a problem ends up scanning the data more than... 18 March 2013 19 min read
Robert Sheldon SQL Server 2012 Window Function Basics For some time, Microsoft had a few window functions, but not the full set specified in the SQL 2003 standard.... 05 March 2013 21 min read
Joe Celko UNIQUE Constraints in SQL Here is an in-depth look at an underused constraint, UNIQUE, that can increase the performance of queries and protect data... 10 January 2013 22 min read
Joe Celko Row Sorting in SQL It should be easy to model a game of poker in SQL. The problem is, however, that you need to... 30 November 2012 10 min read
Joe Celko Matrix Math in SQL Relational Databases have tables as data structures, not arrays. This makes it tricky and slow to do matrix operations, but... 17 September 2012 10 min read
Seth Delconte NULL-Friendly: Using Sparse Columns and Column Sets in SQL Server Sparse columns and column sets in SQL Server 2012 provide a way of accomodating the less-structured data that has always... 10 July 2012 14 min read
Phil Factor Handling Constraint Violations and Errors in SQL Server The database developer can, of course, throw all errors back to the application developer to deal with, but this is... 29 June 2012 27 min read
Joe Celko SQL View: Beyond the Basics Following up from his popular article, SQL View Basics, Joe delves into the main uses of views, explains how the... 28 May 2012 13 min read
Phil Factor Working with CSV Files in SQL Server: ODBC, Linked Server, and T-SQL Parsing Read and write CSV files from SQL Server using three approaches: the ODBC Text Driver, a linked server, and a... 13 April 2012 20 min read