Today I started the day early with a great presentation for the SQL Lunch UK group on Common Table Expressions. For those who attended the presentation here is the Zip file with the Powerpoint and the SQL code from the demo.  Feel free to download it and learn from it. CTE_SQL_LUNCH_UK_May_2012.zip   Here are a few links to some of …

SQL Lunch UK Read more »

One of the common questions that comes up in my CTE class/presentation asks can you use the CTE inside of a function or stored procedure. The answer is yes, but today I came across another question, how can I split a string (varchar) into rows. I did some searching but didn’t find quite what I was looking for. I did …

Using a CTE to Split a String Into Rows Read more »

Its about time, MySQL has had a feature LIMIT which is similar to the  usage of OFFSET and FETCH for years.  Now in SQL Server 2012 Microsoft introduces OFFSET and FETCH. The OFFSET and FETCH functionality is used to achieve data paging server side in TSQL.  Thing of a page like your typical search results where you are shown the …

TSQL 2012 – OFFSET and FETCH Read more »

One of the common questions that I get asked after my Unleashing CTE Presentation is “Can we use CTEs in SSRS reports?” The answer is YES, Common Table Expressions work great in SSRS reports, one of my favorite ways of cleaning up some of those big ugly SSRS report queries is to use CTEs.

Over the last week I have pitched 8 presentations for SQL Connections in Vegas at the end of October 2012.  Hoping that 3 of my presentations get accepted.  Here is the list so far. Using the New Analytic Functions in SQL Server 2012 Exploring the TSQL Enhancements in SQL Server 2012 Unleashing Common Table Expressions in SQL Server Using SSRS …

Working on my Presentations for SQL Connections Fall 2012 Read more »

After the last post on Cumulative Distribution Function (CDF) or as it is known in TSQL CUME_DIST(), I realized that although I showed how to use it, I didn’t really explain what it means, or when to use it.  That is where this example comes in. First lets take an example that generates simulated dice rolls.  What are the odds …

Cumulative Distribution Function (CDF) – Analyzing the Roll of Dice with TSQL Read more »

Continuing on the TSQL 2012 Analytic Series now on to the CUME_DIST function SQL Server 2012 introduces another new analytic function.  The Cumulative Distribution Function CUME_DIST()  refers to the probability that the value of a random variable falls within a specified range. CUME_DIST  is the function that maps values to their percentile rank in a distribution.  CUME_DIST function calculates the possibility …

More TSQL 2012 Analytics CUME_DIST – Cumulative Distribution Read more »