A simple Table Partitioning tutorial for SQL Server 2005 that shows, step by step, how to horizontally partition a database table across two filegroups.
SQL SERVER – Get a Row Per File of a Database as Stored in the Master Database
Each database has at least two files. This quick script on sys.master_files returns a row per file of a database, just as it is stored in master.
UNICODE: Supplementary Characters Depend on the Collation
UNICODE returns an integer for the first character, and supplementary-character support affects that integer. I make the collation explicit when interpreting those values. Otherwise the same visible input can produce a misleading comparison.
SQL SERVER – Time Out Due to Executing DELETE on Large RecordSet
Why does a DELETE on large recordset time out? When you want every row gone, use TRUNCATE instead, but keep in mind it resets the identity value.
Conditional COUNT: ELSE 0 Counts Nonmatching Rows
Conditional COUNT includes zero when CASE returns it. I compare an omitted ELSE with a zero branch before aggregating. A no-match group and an empty input expose the difference from SUM.
SQL SERVER – 2005 – Change Compatibility Level – T-SQL Procedure
The safe way to change compatibility level in SQL Server 2005: single user mode, sp_dbcmptlevel, then multi user again, and how to check it.
SQL SERVER – Reclaim Space After Dropping Variable – Length Columns Using DBCC CLEANTABLE
DBCC CLEANTABLE can reclaim selected space left after dropping variable-length columns. I distinguish that table operation from shrinking a database file.






