Big One Time Use Queries – Revisited
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...
View ArticleRestoring A Log Chain
This is a followup to my Whats more important than a backup plan article posted a couple of months ago. When you do a database restore, including log backups, it is very important to get the log chain...
View ArticleRecursive Scalar Function in T-SQL
In my Common Table Expressions presentation the topic of recursion often comes up, but for scalar functions in T-SQL, it might not be as common. This article has been written to show how a scalar...
View ArticleExecuting a TSQL batch multiple times using GO
Using the GO commend in TSQL to run a batch of code multiple times is something that I commonly do in demo’s and training’s. What amazes me is how many people after the training will tell me that they...
View ArticleUsing the TSQL CHOOSE Function
Here is a short video tutorial that shows how to use the CHOOSE function in T-SQL on SQL Server 2012, SQL Server 2014 or Newer. This was originally part of my free SQL query training for the 70-461...
View ArticleUsing The TSQL EOMONTH Function
Here is a quick video training on how to use the T-SQL EOMONTH function on SQL Server. This was originally part of my free SQL query training for the 70-461 certification exam. The EOMONTH function...
View ArticleWeek 4 – Building the Corrupt Database
The following are the steps that I went through to create a more difficult Database Corruption Challenge for Week 4. Here is how I built the database, nothing fancy, however I did add an extra...
View ArticleUpdating SQL Server Statistics
Updating SQL Server statistics may not be as obvious as it may sound. Imagine this scenario. I invite you over for dinner and a game of Scrabble. After dinner, I start to do the dishes, while you set...
View ArticleInstant File Initialization (IFI)
One way to improve performance on SQL Server is with IFI or Instant File Initialization. Normally files are zeroed out on a database growth during an AUTOGROW, RESTORE, CREATE DATABASE or ALTER...
View ArticleMy CheckDB Script
From time to time I get asked about checkDB, and there are many solutions out there, but I have one that I generally use that is very simple and does the job. The script below created a stored...
View ArticleDetermining how much of your data file has been modified
SQL Server 2017 introduces a new column in the sys.dm_db_file_space_usage system table. The column is modified_extent_page_count, which tells how many pages have been modified in your data file since...
View ArticleBuilding a SQL Restore Script When Your Backup Runs
It is handy to have a SQL Restore script ready to go for every backup that you run. Here is a script that will help with that. -- available at http://databasehealth.com/shared-scripts/ -- Created by...
View Article