IIF in TRANSACT SQL on SQL SERVER 2012
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 …
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 …
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 …
Cumulative Distribution Function (CDF) – Analyzing the Roll of Dice with TSQL Read more »
The OUTPUT clause is often times underappreciated by the TSQL programmer. There are many really interesting things that you can do with the OUTPUT clause, from inserting to two tables with one statement or to replace the SCOPE_IDENTITY option. For …
In a previous article I covered the usage of ROWS PRECEDING and FOLLOWING in the over clause. For this example I am going to use the same database and tables that I created in the previous example to show ROWS UNBOUNDED …
Transact SQL OVER Clause – ROWS UNBOUNDED PRECEDING or FOLLOWING Read more »
With SQL Server versions 2008R2 and 2012, you can access the registry to get the settings for the current instance of SQL Server. Here is how it works using the dynamic management view (DMV) called dm_server_registry. From there you get get …
Accessing the registry from TSQL on SQL Server 2012 and 2008R2 Read more »
First for this example, and a few to follow we need to create the database that we are going to play around in. Next a review of the OVER clause as it is support prior to SQL Server 2012. Which …
It has been a busy week getting ready for SQL Saturday Vancouver, planning sessions to present at future training’s and determining new material to present. Today I submitted 4 sessions to Seattle Code Camp for their June session. Using SSRS …
After rebooting a SQL Server, for whatever reason, it is always good to confirm that the system is running good. There are many things that I check, one of which is to confirm that backups are running. You can always …
Working on a new report for the SQL Server Health reports, I needed to display the amount of free disk space on a SQL Server. EXEC MASTER..Xp_fixeddrives; Which was useful if I just wanted to look, but I needed to use …
Just the same query that I posted months ago, but this time it is wrapped in a stored proc. I use this one often enough that it is easier to just call the stored proc. Download the FindOneTimeUseQueries source code. TSQL example: …