A simple puzzle using UNION and UNION ALL: guess the output of two short scripts before you run them. The hint is my article on UNION vs. UNION ALL.
SQL SERVER – 2005 – Find Highest / Most Used Stored Procedure
Which stored procedure runs most often? My small SQL Server 2005 script finds the most used stored procedure, with execution count, worker time and calls per second.
Solving SQL Puzzles With Set-Based Thinking
Set-based thinking solves three SQL puzzles with grouping, anti-joins, and windows, then turns each solution into a repeatable query habit.
SQL SERVER – Add Column With Default Column Constraint to Table
Add a NOT NULL column with a named default Column Constraint in one ALTER TABLE statement. I always name constraints instead of letting SQL Server pick one.
SQL SERVER – 2005 – Retrieve Any User Defined Object Details Using sys objects Database
The sys.objects catalog view has a row for every schema-scoped object, so you can retrieve any user defined object details, like foreign keys, by object type.
SQL SERVER – 2005 – Retrieve Processes Using Specified Database
Jim Sz shared a quick script to retrieve processes that use a specific database from sys.sysprocesses, with spid, status, host name and login.






