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 »

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 »

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 »

Percent rank is defined as the number of values that are the same or less than the current value divided by one less than the number of values. Percent rank is different than PERCENTILE, stay tuned for PERCENTILE_DISC and PERCENTILE_CONT which are different from PERCENT_RANK. For this example I will be using the same revenue table in the sample database …

More TSQL Analytic Functions – PERCENT_RANK Read more »

This feature has been available since SQL server 2012 and is one of my favorites. It is the Rows/Range enhancements to the over clause. These enhancements are often times referred to as the windowing functions. Overview:ROWS PRECEDING, FOLLOWING, UNBOUNDED, refers to the current row and those before or after based on preceding or following.RANGE PRECEDING, FOLLOWING, UNBOUNDED, means all values …

Rows and Range, Preceding and Following Read more »

The problem with using the default maintenance plans is that SQL Server Management Studio makes it easy to turn on some features that are really bad practice. Transcription: Steve Stedman 0:09Welcome to today’s training video. I’m Steve Stedman. I’m the founder of Stedman Solutions. Today we’re going to talk about one of the common items reported by the sequel daily …

Default Maintenance Plan Shrink Database – Video Tip Read more »

Recently while working on a SQL Server for a client I came across the following error when I attempted to view the SQL Server logs in SSMS. From there I decided I needed to track this down, so I attempted to run the sp_readerrorlog stored procedure, which also failed, but it provided more informaiton. The full error message was: Msg …

sp_readerrorlog – Msg 22004, Level 16, State 1, Line 0 – Failed to open loopback connection. Please see event log for more information. Read more »

While doing a recent server move, I came across the need to script all agent jobs and save them to a file so that if we needed to reference what was there after the move we could get at the agent jobs without having to restart the old SQL Server. It made me realize that sometimes what you want to …

Script all Agent Jobs Using SQL Server Management Studio Read more »