Column List
This sample script will help you capture all columns as well as
adding an alias and properly "quoting" the column name using the QUOTENAME
function.
../../Resources/DemoScripts/Column List.sql
Tabular Output for SHOWCONTIG
This sample script will help you manipulate the tabular data as returned by
DBCC SHOWCONTIG WITH TABLERESULTS - a new feature for SQL Server 2000. At a minimum, at least you won't need to figure out the table definition!
Showcontig with Tableresults.sql
Never Give Base Table Permissions
This sample script will help you to understand how to create stored
procedures to manipulate data - instead of granting base table permissions.
Additionally, you can see how triggers (especially INSTEAD OF triggers) can
help to prevent these to occur even if a Systems Administrator performs the
delete. No one can get past these accidentally!
DeleteASale-NeverGiveBaseTablePermissions.sql
Backup & Restore
This sample script will help you understand the right way to automate database settings in order to perform a batch operation using the BULK_LOGGED recovery model.
DB Alter for Batch Operation.sql
Index Maintenance
This sample script will help you to automate the process of rebuilding indexes using CREATE with DROP_EXISTING for the clustered indexes and DBCC DBREINDEX for the nonclustered. If you are trying to achieve high availability you should consider using DBCC INDEXDEFRAG instead.
sp_RebuildIndexes.sql
|