This section is my Code Library – bits and pieces of code that I find incredibly useful. Most of these will need to be adapted to suit specific purposes.

My policy on any code that you get from the internet (including my blog): If you can’t explain to another person how the code that you’re copying from the internet works, then DON’T USE IT on a production system! After all, you will be the one supporting it!

T-SQL Scripts
Ad-Hoc Querying
Detect Duplicate Key Constraints
Extended Properties – Get All for Object
Grouped Delimited Lists
Maintenance Scripts
OLE Automation
Setting and Restoring Configuration Settings
Shred IO Statistics into Tabular Results
sp_Blitz checks
sp_help_revlogin scripts
Virtual Tally (Numbers) Table

Other Scripts