T-SQL – Derived Tables Demonstrated and Explained

T-SQL is a very powerful language when dealing with sets and in this post, I am going to be demonstrating how to use derived tables. Derived tables are not the same as a temporary or physical tables where the fields and data types are declared. Nor are they subqueries. Instead, as the name implies, the table is […]


I’ve used SELECT TOP (x) many, many times. After learning how to use SELECT, it’s something I quickly learned to use and remains something which I continue to use often. I’ve also used TOP (x) with UPDATE and DELETE statements to limit the number of rows updated or deleted in a statement. I’ve never had […]

Differences Between TRUNCATE TABLE and DELETE

If you want to remove data from a table, you can do this in a couple of ways using TRUNCATE TABLE or DELETE. A common approach is to use DELETE to remove all rows in the table but TRUNCATE TABLE offers an alternative and I will list what the differences between the two are. DELETE […]

New T-SQL features in SQL Server 2012 – THROW

New in SQL Server 2012 as part of exception handling in T-SQL is THROW Exception handling in previous versions of SQL Server THROW will raise an exception inside of the catch block and there are already ways to do this in previous versions of SQL Server but where this is an improvement over previous methods […]

New T-SQL features in SQL Server 2012 – WITH RESULT SETS

New in SQL Server 2012 comes an extension to EXECUTE in the form of WITH RESULT SETS. WITH RESULT SETS allows column names and their data types to be changed in the result set of a stored procedure. My first thought with this improvement is that it could be very useful to have when building […]