To attach a Database with T-SQL, I use CREATE DATABASE … FOR ATTACH. A customer asked about attaching existing data and log files.
Capture sp_who2 Output Into a Table With INSERT EXEC
To capture sp_who2 output, create a table with matching columns and fill it with INSERT EXEC. This post builds the table, captures the session list three times with a time stamp, and shows the two errors that stop the method.
DMV Version of sp_who2: A Cleaner Session List
A DMV version of sp_who2 returns the same session details from documented views and leaves out the system tasks. This post builds the query, shows why the old spid above 50 filter fails, and stores the result in a temporary table.
Line Numbers for SSMS Efficiency – SQL in Sixty Seconds #147
This is when the line numbers in SSMS comes in extremely handy and let us learn in today’s blog post how we can do that. Let us learn today.
Finding Old Agent Jobs Not Run in Months or Never Scheduled
Review agent jobs not run recently or lacking schedules, combine history and activity, and disable approved candidates for review.
Slow Running Query – SQL in Sixty Seconds #146
One of the most popular questions I receive during Comprehensive Database Performance Health Check is if I have a script that lists Slow Running Query.







