Stale statistics can hurt a query plan. Use STATS_DATE to find the statistics update date for each index, then update them if they look outdated.
Building Your Own Sample Data Set
Build a sample data set with realistic keys, skew, NULLs, and repeatable generation when a downloaded sample misses the lesson.
SQL SERVER – DMV Error: FIX: Error: Msg 297, Level 16 The user does not have permission to perform this action
Msg 297 appears when a user runs a DMV without the right permission. Ask your admin to GRANT VIEW SERVER STATE, and the DMV runs without errors.
SQL SERVER – Get Server Version and Additional Info
Most people check the SQL Server version with @@VERSION. I also like xp_msver, which shows extra details about the server where SQL Server is installed.
SQL SERVER – Find Busiest Database
How do you find the busiest database on a SQL Server instance? I use sys.dm_exec_query_stats to add up logical reads and writes for each database.
SQL SERVER – Fragmentation – Detect Fragmentation and Eliminate Fragmentation
What is fragmentation, and how do you detect fragmentation and eliminate it? I explain the internal and external types and what each one does to your pages.






