This is our collection of SQL Server scripts that we find useful.
We hope you find them useful too.
SQL Script Description
Backup all databases on a server. Creates the script for later use or performs the backups. This is useful on servers that are not part of your normal backup plan (i.e., development server) or for backups outside of your normal schedule.
Check all the CODE / FLAG values in the specified table. This is useful with poorly designed tables (flat tables) or on development / staging tables or when researching new data. If the database is fully normalized there usually won’t be multiple code values in a single table.
Scan a database server looking for objects, columns or object text containing the specified search string. Searches all databases.Useful when gathering technical specifications or trying to find all instances where a text string is used.Will search for the following objects:
Logins, Users, Roles, Schemas
Text within unencrypted stored procedures, functions, triggers
Functions that do a SELECT FROM another source (no other searches are performed with this search)
Find a value in any column in any table in a database. Use caution running this on non-development or shared environments. It can be very resource intensive. It does a complete table scan on every table in the database.
Scan a database server and give a very rough estimate for development time based on the number of stored procedures, functions, tables and views. Time is also based on number of columns, number of functions or complex procedures used and number of bytes of code.This was used to give a VERY rough estimate on how long it would take to re-create all of the databases and objects in a server when moving to a new vendor and platform. It will need to be modified heavily to apply to your environment.
Generate recommended indexes using system DMVs. Consolidate the recommended indexes and consolidate the recommended indexes with the existing indexes. See the full description on our page SQL Server Index Automation.