Tag: SET

My 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 procedure in

Posted in Uncategorized Tagged with: , , , , , , ,

Instant 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 DATABASE. This is done by SQL Server when

Posted in Performance, Performance Tuning Tagged with: , , , , , , ,

Updating 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 up the

Posted in Performance Tuning Tagged with: , , , , , , ,

Week 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 FILEGROUP called [UserObjects]. Notice, that

Posted in Corruption Tagged with: , , , , , , ,

Using 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 returns the last day of a given

Posted in 70-461 Training, TSQL 2012 Tagged with: , , , , , ,

Using 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 certification exam. Here

Posted in 70-461 Training Tagged with: , , , , , , ,

Executing 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 didn’t know

Posted in SQL 2014, TSQL Tagged with: , , , , , , ,

Recursive 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 function in SQL Server can

Posted in TSQL Tagged with: , , , , , , , , ,

Restoring 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 in the

Posted in Recovery Tagged with: , , , , , , ,

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 FindOneTimeUseQueries source code. TSQL example:

Posted in Performance Tagged with: , , , ,