You have a table A with new data, and a table B with old data. How … The T-SQL Merge statementRead more
T-SQL
Identity columns that are about to overflow
Identity columns are widely used as primary key columns in SQL Server tables. They can be … Identity columns that are about to overflowRead more
Split strings to columns
A short demo on how to split strings with delimiters into columns.
Create XML with T-SQL function FOR XML
Some time ago I demonstrated how to use XQuery to map a hierarchical XML document into … Create XML with T-SQL function FOR XMLRead more
How to fill in gaps in time series
In some cases it is necessary to have an unbroken time series, for instance to have … How to fill in gaps in time seriesRead more
Sending HTML tables in mail from SQL Server
This post contains a template for sending HTML tables via mail in T-SQL. A prerequisite is … Sending HTML tables in mail from SQL ServerRead more
Mass editing of SQL Server objects
Ever had the need to replace a piece of code in multiple SQL Server objects (Stored … Mass editing of SQL Server objectsRead more
A T-SQL WHILE loop demonstration with BREAK and CONTINUE
Just a short blog post to demonstrate the use of a WHILE loop in T-SQL, together … A T-SQL WHILE loop demonstration with BREAK and CONTINUERead more
T-SQL Pivot and Unpivot
A simple demonstration of the Pivot and Unpivot functions in T-SQL.
Max or min value from a set of columns
The min and max aggregates in SQL Server are normally used to work over rows, getting … Max or min value from a set of columnsRead more