It can be a bit time consuming to work through the the SQL Server Management Studio (SSMS) user interface to check on the agent job history to find specific agent jobs that have been run. To help speed that process up, I created the following TSQL script to directly query the job history. This query makes use of a common table …

TSQL Script to Display Agent Job History Read more »

Its not always quick and easy in SQL Server to get a full list of the jobs that have been run, when they were run and how long they took. I created the following script to quickly check on the status and run time of SQL Server maintenance plans and jobs. Display Job History Just run the script in SQL …

SQL Server Script to Display Job History Read more »

The alternate solution to the Database Corruption Challenge this week was created by Patrick Flynn. This solution is the only solution to successfully recover all the data without using any of the backups. If the challenge had been structured differently and all you had was just the database files and no backups, this solution would work just fine. As you …

Database Corruption Challenge Week 7 – Alternate Solution Read more »

Here is a quick video tutorial on how to use the T-SQL GetDate function on SQL Server 2012, SQL Server 2014 or newer. This was originally part of my free SQL query training for the 70-461 certification exam. Here is the sample code that goes with the video. See Also Additional Training on my YouTube Channel Free SQL Query Training 70-461 …

Using the TSQL GetDate Function Read more »

Being day 24 of the DBCC Command month at SteveStedman.com, today’s featured DBCC Command is DBCC SHRINKDATABASE. When I first heard about DBCC Shrink Database (many years ago), I immediately thought “what a great feature, run this every night when the system load is low, and the database will be smaller, perform better, and all around be in better shape”. …

DBCC ShrinkDatabase Read more »

Is it a good idea to run DBCC SHRINKDATABASE regularly? Download the sample file ShrinkSample. This article and samples apply to SQL Server 2005, 2008, and 2008R2. This really depends on a number of factors, but generally the answer is NO, it is not a good idea to run DBCC SHRINKDATABASE regularly. For the purpose of this article, I am …

Index Fragmentation and SHRINKDATABASE Read more »