Russian Nesting Dolls If you have ever seen the Matryoshka dolls known as the Russian nesting dolls or babushka dolls they are very interesting. They start with a large wooden doll that when opened contains a slightly smaller doll, then inside of that one an even smaller doll. These dolls often have five to eight dolls nested inside of each …

Nested CTEs Read more »

In 2012 SQL Server introduced the SEQUENCE object.  Looking at the syntax it is very similar to how Oracle has implemented SEQUENCEs for many years.  I believe that the SEQUENCE was introduced to aid in the transition of Oracle developers to SQL Server. First off what is a SEQUENCE???… A user-defined object that generates a sequence of numeric values. To …

SQL Server SEQUENCE Read more »

Take the following sample code.    Four similar tables with an INT IDENTITY, BIGINT IDENTITY, and two with UNIQUEIDENTIFIERS, one using newid() and the other with newsequentialid(). Once the tables are created and we insert 100,000 rows into each, they are very similar, but they take up very different amounts of disk space. Using the Database Health Reports application, we …

Should I Use A Unique Identifier As A Primary Key? Read more »

Have you ever needed to generate a list of dates for the last 30 days.  There are lots of different ways to do this with TSQL, but one way is with a recursive CTE. You can then left join against it with another query to generate a list of all  dates in a result set, along with the dates for …

Recursive CTE to Calculate Dates for the Last 30 Days Read more »

TSQL Pivot Table TSQL Pivot Table?  What’s that? Here is a quick sample of how to implement a pivot table in TSQL for SQL Server. The example below creates a database called pivot, you probably already have your own database to work in. Then it… Read more… Excited to Release Training Videos Just this week the team at Stedman Solutions …

August Blog Post Wrap-up Read more »

Just this week the team at Stedman Solutions finished the SQL Server JOIN Types paid training course. I am very excited to complete this and to make it available to the SQL Community. Whether you have been writing SQL Queries for 10 years, or you are on connecting your first 2 tables in a query, there is something that you …

Excited to Release Training Videos Read more »

Recently I have been on the LEAN improvement quest to make a 2 second improvement in my process every day. Part of that improvement is to avoid switching to the mouse when you don’t have to.  Here are some shortcut keys that I find very useful in SQL Server Management Studio, some of which I just discovered recently. Window + …

What’s your favorite SSMS time saving hotkey? Read more »