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 TABLE ( DateAdded SMALLDATETIME, Points … [Read more...] about T-SQL – Determine the Difference in Values Between Columns in Different Rows
sql server 2012
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 once you have taken it you will be emailed a voucher for the second exam at no additional … [Read more...] about SQL Server Certification – 2 for 1 exam offer
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 post, there is no cost involved in running these labs. They don't just cover SQL Server 2012, there are … [Read more...] about SQL Server Virtual Labs saves you time and resource
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 SSIS packages which read from a stored procedure as a data source. We'll take a … [Read more...] about New T-SQL features in SQL Server 2012 – WITH RESULT SETS
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 a covering index? A covering index is a non-clustered index which includes … [Read more...] about SQL Server covering index and key lookup performance