Scripts

Valuable SQL Server Scripts tips, tutorials, how-to’s, scripts, and more for SQL Server Developers.

Title Author Date
SQL Server Search all String Columns in Tables or Views Aaron Bertrand2026-06-01
Scan a SQL Server Database for Objects and Columns Ken Simmons2026-05-10
Search all string columns in all SQL Server databases Aaron Bertrand2026-05-08
SQL Server Row Count for all Tables in a Database Dattatrey Sindol2026-05-03
sp_msforeachdb to Execute the Same Command on all SQL Server Databases Tim Ford2025-12-30
Search and Find String Value in all SQL Server Table Columns Greg Robidoux2025-05-21
Executing a TSQL batch multiple times using GO Greg Robidoux2024-06-21
Auto generate SQL Server UPDATE triggers for data auditing Ranga Narasimhan2021-12-22
Save SQL Server Database Structure as Json Mircea Dragan2020-01-13
Standardize SQL Server data with text lookup and replace function Greg Robidoux2019-03-18
Making a more reliable and flexible sp_MSforeachdb Aaron Bertrand2018-07-24
Issues with SQLCMD when using special characters Daniel Farina2018-01-11
SQL Server CTE and XML Recursion Script Bhavesh Patel2017-11-16
Fix SQL Server CTE Maximum Recursion Exhausted Error Ahmad Yaseen2017-10-13
Stored procedure to generate HTML tables for SQL Server query output Eli Leiba2017-09-08
Script to attach multiple SQL Server MDF files Eli Leiba2017-08-25
How to move a project from CodePlex to GitHub Andy Novick2017-06-07
Use T-SQL to Find Folders Using the Most Disk Space Eli Leiba2017-06-02
Script to find oldest open SQL Server transaction Eli Leiba2016-11-22
Script SQL Server Logins for Disaster Recovery K. Brian Kelley2015-06-18
Accessing OLE and COM Objects from SQL Server using OLE Automation Stored Procedures Derek Colley2014-08-21
How to use SQL Server CTEs to make your T-SQL code readable by humans Andy Brown2013-06-17
Script to Find and Drop All Orphaned Users in All SQL Server Databases Dale Kelly2012-02-10
Iterate through SQL Server database objects without cursors Arshad Ali2009-12-21
Script to check that backup files still exist for SQL Server Thomas LaRock2009-07-23
List columns and attributes for every table in a SQL Server database Tim Ford2009-06-26
Splitting Delimited Strings Using XML in SQL Server Divya Agrawal2009-06-12
Capture all statements for a SQL Server session Greg Robidoux2009-03-18
SQL Server Find and Replace Values in All Tables and All Text Columns Greg Robidoux2008-08-05
Find All Columns in SQL Server Database with Default Values Tim Ford2008-06-04
SQL Server Script to Create Windows Directories Tim Ford2008-03-21
Find text strings in character data types using SQL Server LIKE Operator Greg Robidoux2007-10-08
File Validation in SQL Server with xp_fileexist stored procedure Jeremy Kadlec2007-06-25
Obtain Exclusive Access to a SQL Server Database Jeremy Kadlec2007-05-21
Kill SQL Server Process Ids (spids) Jeremy Kadlec2007-05-18