Log-shipping Queries

First check the last file copied and restored to the secondary. Run the following queries on the secondary node. The following query…

T-SQL for identifying slow-running queries on a database

Views – 694

T-SQL to check the properties of all the databases on a server

Views – 869

How to shrink huge log files

Here is a short script to quickly shrink your log file if you DO NOT NEED to ever recover the database before the…

Some thoughts on auto-incrementing IDs

The implementation & syntax feels like an afterthought, like the engineers of SQL Server made something self-consistent, and then the market research wing…

Configure Email Alerts via T-SQL

You can run the following SQL script to ensure email alerts are configured for the LSCopy and LSRestore jobs:

Views – 773

Using the LIKE keyword more efficiently

from Pinal Dave’s article here: http://blog.sqlauthority.com/

The previous query does find FirstName values beginning with the letters ‘A’ thru ‘K’. However, when…

Using sp_WhoIsActive

Here is an awesome extentions of the sp_who and sp_who2 (undocumented) sprocs DBA’s use to see slow running queries etc. Download link for…