This repository contains all helping SQL Server Script which will use in day to day life to troubleshoot and understand SQL Server Health.
- Select Primary Key value from Table dynamically-Sql Server
- Find Blocking queries in Sql Server
- Find Most Expensive Stored Procedure Sql Server
- Find most expensive queries-Sql Server
- Find most expensive tables-Sql Server
- Find most used column names in database – Sql Server
- Find out all tables without indexes in Sql Server
- Find redundant indexes Sql Server
- Find unused Indexes – Sql Server
- Generate CREATE Index script for all indexes in database in Sql Server
- Get all available Databases in SQL Server Instance
- Get all schemas in SQL Server database
- Find the total size of the Indexes Script - SQL Server
- Who has CONNECT permission for an endpoint script - SQL Server
- Find last restarted time of SQL Server
- Find stored procedures which have used Temporary Table
- Find stored procedures which have used Dynamic Sql
- find a list of Weekends between given two Dates in SQL Server
- Script to take backup of all database
- Find the largest Objects along with Indexes size - SQL Server
- Find size of Tables in sql server
- Find the list of Triggers script - SQL Server
- Check the file exists or not (By Using xp_fileexist ) Script - SQL Server
- Find the Service Account Name Script - SQL Server
- Get list of CHECK Constraints of Database Script - SQL Server
- Find Unused Index Script - SQL Server
- Find Database USER LOGIN Information Script - SQL Server
- Find total no of sessions for each Databases - SQL Server
- Find total number of Sessions of a Database - SQL Server
- Find the source of connection leaks script - SQL Server
- Find waiting Queries which are block by other running Queries Script - SQL Server
- Find Most Expensive Stored Procedure Script - SQL Server
- Find top 10 most CPU utilizing Queries - SQL Server Script
- Most expensive queries - SQL Server Script
- Find Blocking Queries - SQL Server Script
- Find Memory Utilization for each database - SQL Server Script
- Get the CPU Information from Registry - SQL Server Script
- Generate Shrink Script for each Database File - SQL Server Script
- Find Memory usage and allocation - SQL Server Script
- Drop all nonclustered Indexes - SQL Server Script
- Find disable foreign key tables - SQL Server Script
- Find Large Object Data Type Columns - SQL Server Script
- Find a Table which has more than N columns - SQL Server Script
- Find a Table which has more than N Indexes - SQL Server Script
- Sql Server Maintenance Script, includes rebuild & reorganize index and update statistics
- Get all NonClustered Indexes from Database - SQL Server Script
- Get all Clustered Indexes generated with primary keys only from Database - SQL Server Script
- Get all Clustered Indexes from Database - SQL Server Script
- SQL SERVER Script: Get all NonClustered Indexes which are with Unique Key constraint only from Database
- SQL SERVER Script: Get all NonClustered Indexes list which are with Unique Key constraint only from Database
- Find database size - SQL Server Script
- Check Newly Allocated Pages to the Table - SQL Server Script
- Drop a Table from all Databases - SQL Server Script
- Rename all Tables of a Database - SQL Server Script
- Check the status of running Database Backup - SQL Server Script
- Find total number of Sessions - SQL Server Script
- Get the definition of Trace Script - SQL Server
- Check If Mirroring enable for Database Script - SQL Server
- Find fragmentation of Columnstore Indexes
- Find the Location of Database Backup Files - SQL Server Script
- Find all Columns information of a Database - SQL Server Script
- Find all Default values with Columns - SQL Server Script
- Find Last Backup Time for All Databases - SQL Server Script
- Find a different Server Property - SQL Server Script
- Find usage of Database Indexes - SQL Server Script
- Find Index Operational Stats - SQL Server Script
- Find Open transactions in SQL Server
- Find last DDL changes in SQL Server
- Find Running Process and Session in SQL Server
- Find Foreign key References in SQL Server
- Find out most recently modified Stored Procedure and Table in SQL Server
- Find CPU usage per Different Objects - SQL Server Script
- Find Slowest Running Query in SQL Server
- Find Cross Database Object Dependency in SQL Server
- Find Object Dependency in SQL Server
- sys.dm_column_store_object_pool to find memory pool usage by Columnstore Indexes - SQL Server 2016
- sys.column_store_row_groups to find information on Columnstore row groups - SQL Server 2014
- Find Outdated Statistics - SQL Server Script
- SQL Server Script to kill all processes for Database
- Find Index Average Fragmentation in Percentage - SQL Server Script
- Find Missing Indexes - SQL Server Script
- SQL Server 2016 Script to get information of Cached Functions with Total Execution Time
- SQL Server 2014 Monitor Memory Optimized Tables which stored in Memory
- Script to find the Forwarded Records count of a Table - SQL Server
- Use sp_MSforeachtable to apply a T-SQL command to every table of selected Database in SQL Server
- SQL Server Script to find invalid Foreign Keys
- SQL Server Script to check the size of Query Plan Cache
- SQL Server script to find dirty pages from Memory, when DBCC DROPCLEANBUFFERS fails
- SQL Server Script to find SOS_SCHEDULER_YIELD wait type usage
- SQL Server Script to check the Allocation Units of a Table
- SQL Server Script to execute Update Statistics for all Databases
- SQL Server Script to find Open Transaction to avoid Deadlock
- SQL Server Script to identify current Authentication Mode
- SQL Server script to find Log Sequence Number (LSN) from Database Backup Files
- Script to change Schema of all the Tables SQL Server
- SQL Server Script to enable and disable Auto Create Statistics
- SQL Server script to Enable and Disable Auto Update Statistics
- SQL Server Script to Enable and disable Auto Update Statistics Asynchronously
- SQL Server Script to find all System Objects related to File Table
- SQL Server script to find auto created Statistics Objects
- SQL Server Script to Find Statistics Information of the Database Objects
- SQL Server Script to find waiting Queries which are block by other running Queries
- SQL Server Script to find top 10 Stored Procedure which are utilizing more CPU
- SQL Server Script to find all Running SQL Server Agent JOB
- SQL Server script sp_updatestats to update the Database Statistics
- SQL Server script to Find the total row count and size of the Tables
- SQL Server Script to find the size of Database Files and Log Files
- SQL Server Script to find total Row Count of All Tables in a Database
- SQL Server Script to find CPU Pressure using Signal Wait Time
- SQL Server Script to Hide all Databases in SSMS
- SQL Server Script to find Status of all Database Trigger
- SQL Server Script to List all Dynamic Management Views and Functions
- SQL Server Script to find Identity Column of a Database
- SQL Server Script to find all the Tables without having a Primary Key
- SQL Server Script to find Databases from all the Instances
- SQL Server Script to find PORT information of an Instance
- SQL Server Script to monitor the Corrupt Database Pages
- SQL Server Script to find bad Sessions or Processes
- SQL Server Script to find Open Connections and CPU Usage of each Client Programs
- SQL Server Script to find last statement executed by a SPID using sys.dm_exec_input_buffer
- SQL Server Script to find all Backup History Information
- SQL Server Script to make Database Read Only
- SQL Server Script to make Database Read Write
- SQL Server Script to check all Database Autogrowth Settings
- SQL Server Script to find and change Compatibility Level of Database
- SQL Server Script to find Estimated Finish Time of The Backup Database
- SQL Server Script to find Estimated Finish Time of The Restore Database
- SQL Server Script to find uncontained objects of a Database
- SQL Server: Script to Enable and Disable XP_CMDSHELL Configuration
- SQL Server 2012 Introduced dm_db_log_space_usage to find a Log size
- SQL Server Script to change the Recovery Model of a Database
- SQL Server Script to find the status of Trace is running or not
- SQL Server Script to find Installation Date, time and Authentication Mode
- SQL Server Script to get all tables from database
- Remove Cross duplicate rows in SQL Server