When DTS, BCP or BULK INSERT needs an index out of the way, I prefer to disable index with ALTER INDEX and enable it again with REBUILD. AdventureWorks example.
SQL SERVER – Binary Sequence Generator – Truth Table Generator
A script that builds a 512 row truth table with its decimal value and binary sequence, using CROSS JOINs on a bit table. Add or remove joins to resize it.
SQL SERVER – DBCC commands List – documented and undocumented
The full list of documented and undocumented DBCC commands with their syntax, plus how DBCC TRACEON(2520) and DBCC HELP show all of them in Query Analyzer.
Last Line of a SQL Script: The Joke Every DBA Has Lived
The last line of a SQL script decides whether your work is saved, rolled back, or still holding locks. Here are the classic endings and how to check them.
SQUARE: Expect a float Result From Numeric Inputs
SQUARE accepts numeric inputs convertible to float and returns float. Explicit decimal display keeps this small example readable without claiming exact decimal multiplication.
SQL SERVER – Query to Find First and Last Day of Current Month – Date Function
One query to find the First and Last Day of Current Month in SQL Server, plus the last day of the previous month and the first day of the next.
SQL SERVER – UDF – Function to Parse AlphaNumeric Characters from String
UDF_ParseAlphaChars keeps only the alphanumeric characters in a string and strips everything else using PATINDEX and STUFF. A handy function, with a test.
SQL SERVER – 2005 – List all the database
Several ways to list all the database names on a server, from sp_databases and sp_helpdb to sys.databases and sp_msForEachDB. I use sp_databases myself.










