A last resort for corrupt datafiles with no backup: emergency mode, single user, then DBCC CHECKDB with repair_allow_data_loss. Back up the files first.
SQL SERVER – 2005 – Transferring Ownership of a Schema to a User
Transferring ownership of a schema to another user in SQL Server 2005 takes one ALTER AUTHORIZATION ON SCHEMA statement. A reader asked, so here it is.
SQL SERVER – Find Nth Highest Salary of Employee – Query to Retrieve the Nth Maximum value
How do you find the Nth Highest Salary of an employee? I link my earlier answers and share reader Pravin Phatangare’s simple TOP query for the 6th highest salary.
DATEPART tzoffset: Read the Signed Offset in Minutes
DATEPART tzoffset extracts an offset in minutes. Preserve its sign, test sub-hour values and retain the source temporal type.
Simple CASE and NULL: Use a Searched Condition
Simple CASE and NULL do not match through equality. Use a searched IS NULL branch, preserve empty text, and make the result type explicit.
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 – What is CLR?
CLR is the Common Language Runtime. A diagram of its architecture, and why CLR stored procedures in C# help with the loops and recursion that slow down T-SQL.







