Various T-SQL scripts, code blocks or routines for daily use.
Indexes
- Generate indexes REBUILD/REORGANIZE script based on fragmentation level
- Missing indexes by average estimated impact
- Rebuild all indexes in database with fragmentation level and pages count set
- Rebuild all indexes on table
- Rebuilding all indexes in database (cursor version)
- Rebuilding all indexes in database and statistics update
Metadata
- Check for name of an object in all databases
- Compressed Tables List
- Generate UNION ALL views for all tables from all databases with the same schema
- List all tables and columns with user-friendly datatype names
- List Foreign Key Relations
- List of all Columns with Default Constraint participating in Foreign Key
- List of database tables with column names divided by comma
- List of Tables with Columns, Data Types and Primary Key and Identity information
- Number of Rows and Data and Indexes Space Used Per Table
- Primary Keys List
Tables
- Backup single table with timestamp
- Drop all tables in database
- Drop all tables in schema (WHILE mode)
- List all Tables with IDENTITY column exists information
- List of Tables with Number of Rows Including Data and Indexes Size
- Reset IDENTITY_INSERT setting for session in case it is ON for unknown table
- Reset IDENTITY_INSERT to OFF for all tables
- Truncate all tables in database
