SELECT vs. SET for local variables: SELECT can assign several at once and runs faster in a loop, while SET is the ANSI standard and assigns one at a time.
SQL SERVER – Difference Between Unique Index vs Unique Constraint
Unique Index vs Unique Constraint: is there a difference? No. A unique constraint creates a unique index, and performance is the same. Syntax for both.
SQL SERVER – Enable xp_cmdshell using sp_configure
Enable xp_cmdshell with sp_configure: turn on show advanced options, set xp_cmdshell to 1 and run RECONFIGURE. The full script is ready to run in SSMS.
SQL SERVER – 2005 Take Off Line or Detach Database
To take off line a database in SQL Server 2005, use ALTER DATABASE SET OFFLINE with ROLLBACK AFTER 30 SECONDS or ROLLBACK IMMEDIATE instead of sp_dboption.
SQL SERVER – TRIM() Function – UDF TRIM()
SQL Server 2005 has LTRIM() and RTRIM() but no TRIM() function, so I wrote a simple UDF for SQL Server 2000 and 2005 that trims both sides. Video included.
SQL SERVER – Query to Find Seed Values, Increment Values and Current Identity Column value of the table
A query to list every identity column with its seed, increment and current value, plus what those numbers mean and how to reseed a table safely.







