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 »

I finished my draft copy of my chapter titled “Minimal Downtime and Minimal Risk SQL Server Upgrades” for the SQL Tribal Knowledge book. I am sure there will be some editing and cleanup to do, but for now I am calling the draft copy complete. What a great experience getting this chapter together. I hope that the other writers had …

Finished my Draft Copy of my Chapter for SQL Tribal Knowledge book 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 »

So far after playing around with SQL Server 2012 there are many new features to SQL.  Overall I think my favorites are in the Analytic Functions category.  Here is my breakdown of the top 10 transact SQL enhancements to SQL Server 2012. 10.  New SEQUENCE object 9.  CHOOSE function 8.  Analytics – Analytic Functions – PERCENT_RANK 7.  Analytics PERCENTILE_DISC and PERCENTILE_CONT 6. …

My Top 10 TSQL Enhancements in SQL Server 2012 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.

For years I have heard the question of how can I do an IIF in TSQL?  Honestly I never thought it would be that useful since the CASE statement is easy enough to use, but after seeing it in TSQL 2012, I can safely say I like it. The answer used to be, just use the CASE statement, and the …

IIF in TRANSACT SQL on SQL SERVER 2012 Read more »

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 »

A couple years ago in my Incident Safety Officer class with the fire department we studied risk assessment for any incident that the fire department may respond to.  Since that time I have used a similar risk assessment matrix for SQL Server upgrades, and other big SQL Server maintenance tasks. The risk assessment matrix as it is used by the …

Risk Assessment Matrix for SQL Server Upgrades 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 »