T-SQL – Determine the Difference in Values Between Columns in Different Rows

Have you ever needed to calculate the difference between columns in two or more rows in a table using a T-SQL query? For example you might want to run some trend analysis or audit data for changes. Thankfully using ROW_NUMBER() and Common Table Expressions (CTE’s), this can easily be achieved. –create our table DECLARE @TableRows […]

SQL Server Certification – 2 for 1 exam offer

I came across this today and wanted to share it with you. If you are interested in SQL Server certification then for a limited time, Microsoft are offering “2 for 1” on SQL Server exams. Between April 11 2012 and June 30 2012, you can purchase a SQL Server exam at full price and then […]

SQL Server Virtual Labs saves you time and resource

If you have wanted to try SQL Server 2012 and learn about its new features but have not had the time or capacity to set yourself up a test environment then go over to SQL Server Virtual Labs where you can fire up SQL Server 2012 in an instant. At the time of writing this […]

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 […]

SQL Server covering index and key lookup performance

In this post, I wanted to write about the covering index and key lookup and how adding covering indexes can help increase performance by reducing lookups to the table data. It’s helpful to know what each of these terms mean and then we will look at an example scenario further down the post. What is […]