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.
Bitwise Flags: Test, Add and Toggle Individual Bits
Bitwise flags use AND to test, OR to add and XOR to toggle a mask. Keep flag meanings explicit and preserve missing values in read-only examples.
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.







