Find database status such as ONLINE, OFFLINE, RESTORING or SUSPECT using sys.databases or DATABASEPROPERTYEX, and learn what each status means.
SQL SERVER – 2005 – Find Database Collation Using T-SQL and SSMS
Two ways to check database collation using T-SQL and SSMS in SQL Server 2005, and why DATABASEPROPERTYEX in T-SQL is the one I recommend.
SQL SERVER – Difference and Explanation among DECIMAL, FLOAT and NUMERIC
What is the difference between Decimal and Numeric? None, they are the same. Float is different: it is approximate, while Decimal keeps exact precision.
SQL SERVER – 2005 – Use Always Outer Join Clause instead of (*= and =*)
My friend’s queries failed in SQL Server 2005 because they used *= and =* for joins. Always use the LEFT or RIGHT outer join clause instead.
GROUPING_ID: Separate Stored NULL Values From ROLLUP Totals
GROUPING_ID helps me distinguish a stored NULL from a subtotal created by ROLLUP. Both can appear in the same column. I keep the grouping bits beside the numbers before adding presentation labels.
SQL SERVER – T-SQL Script to Attach and Detach Database
Detach Database operations remove a database from its instance without deleting its files. I preserve a recoverable backup before moving them.







