Good tuning starts with good numbers. In Notes from the Field #018, David Klee explains performance statistic collection and how DBAs should gather server data.
Sending an HTML Table by Email With sp_send_dbmail
Turn a wall of report text into a clean table. FOR XML PATH escapes your data, and a few small tricks handle NULL values and empty days.
The Outbox Table: Publishing Changes Reliably From a Transaction
Orders commit and the message vanishes? Save both in one transaction, then let a worker claim, send and retry with a lease. Duplicates are still possible.
Storing Images in varbinary(max): Size, Reads and Backups
Store images in varbinary(max), read file bytes with OPENROWSET, inspect LOB allocation, and evaluate backup and retrieval costs.
SQL SERVER – Listing Primary Key of Table with Stored Procedure sp_pkeys
Here is how to list the primary key of a table with the stored procedure sp_pkeys, a follow up to my earlier post on sp_fkeys.
SQL SERVER – Listing Foreign Key Relationships of Table with Stored Procedure sp_fkeys
A quick trick to list all the foreign key relationships of a table with the stored procedure sp_fkeys, with a sample script on AdventureWorks2012.
Learning SQL Wait Stats: The Complete Series Guide
Learning SQL Wait Stats is the fastest way I know to find out why a SQL Server is slow. This guide lists every post in my wait stats series, told as one story about an all-night diner, and answers the questions readers ask before they start.





