Wayne Sheffield walks through several useful techniques for T-SQL developers:
And here we have a T-SQL solution for Day 1 of the Advent of Code challenge. The key tasks that we can learn from today are:
Loading a file.
Split a string on a delimiter.
Including additional rows into a result set (adding the first zero with a UNION ALL).
Multiplying (duplicating) a result set multiple times.
Performing a running total calculation.
Assigning a sequential number to a set of rows in a specific order.
Use of the GROUP BY and HAVING clauses while performing an aggregation.
Read the whole thing.