SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Add a script

   Items 1 to 20 of 3546    Older >>

Disable or rebuild all nonclustered indexes on a table

Can be useful when inserting a lot of data into a table.  Read more...
By Jonathan Roberts 2019/02/14 | Source: SQLServerCentral.com | Category: indexes
Rating: |  Discuss |   Briefcase | 24 reads

Find text in sql modules

This stored proc searchs for any text in sql modules throghout users databases  Read more...
By Peter Shilovich 2019/02/19 | Source: SQLServerCentral.com | Category: text search
Rating: |  Discuss |   Briefcase | 182 reads

Missing indexes and consumption of resources

performance optimization 
By Paolo Salamone 2019/02/14 | Source: SQLServerCentral.com | Category: diagnostic
Rating: |  Discuss |   Briefcase | 253 reads

Alert DBA - High SQL Server CPU Usage

Collect CPU % for a time period and alert if Average CPU usage is high  Read more...
By SQL!$@w$0ME 2019/01/14 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 180 reads

Files with larger disk consumption

This script features as we can through the CTE Top10FilesWithLargerDiskConsumption the top ten data files that are showing greater consumption of hard drive related data-reading activities.  Read more...
By Junior Galv√£o - MVP 2019/01/15 | Source: SQLServerCentral.com | Category: cte
Rating: |  Discuss |   Briefcase | 302 reads

Quick SQL connection and process details with current SQL - Version2

Quick check SQL connection and process details with current SQL text  Read more...
By Venugopal Saride 2018/12/06 | Source: SQLServerCentral.com | Category: sid
Rating: |  Discuss |   Briefcase | 464 reads


Starting from a string, it returns values embedded in delimiters.  Read more...
By Carlo Romagnano 2018/11/29 | Source: SQLServerCentral.com | Category: splitting strings
Rating: (not yet rated) |  Discuss |   Briefcase | 265 reads

Automatically Failover (Enable or Disable) Jobs Based on HADR Role

If you have a SQL Server with a High Availability solution (AlwaysOn Availability Groups, Database Mirroring, etc.), and you also have a bunch of jobs which you need to be run on the Primary server only. You need to be able to "failover" the jobs in case the Primary server is no longer Primary.  Read more...
By Eitan Blumin 2018/11/14 | Source: SQLServerCentral.com | Category: always on
Rating: (not yet rated) |  Discuss |   Briefcase | 269 reads

Data Dictionary

I use this script to create data dictionaries.  
By Timothy Harms 2018/11/15 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 552 reads

String Replace in Stored Procedures with Powershell

Find a string in a stored procedure and replace with powershell  Read more...
By Michael D'Spain 2018/11/13 | Source: SQLServerCentral.com | Category: powershell
Rating: (not yet rated) |  Discuss |   Briefcase | 262 reads


Some times you need to parse over punch values at the while running a query. Here is an utility function to help with that task.   Read more...
By Bernabe Diaz 2018/11/07 | Source: SQLServerCentral.com | Category: parsing
Rating: (not yet rated) |  Discuss |   Briefcase | 137 reads

view generator

generate views for all tables in a source schema in a target schema. the view will have the same name as source tables  Read more...
By Flashx 2018/11/08 | Source: SQLServerCentral.com | Category: views
Rating: |  Discuss |   Briefcase | 341 reads

Disk Space Check

I was using this script to check disk space on individual servers for quite some time. And now since I started to use registered servers for MS SQL, I thought of a little modification to the script.   Read more...
By Rinu George Philip 2018/11/09 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 380 reads


Better* than sp_who2, with less re-checking data to get answers. Also, it is SnaZy. With a capital Z. *Dont you just love totally non subjective assessments like this?  Read more...
By Nicholas Williams 2018/11/01 | Source: SQLServerCentral.com | Category: blocks
Rating: |  Discuss |   Briefcase | 761 reads

Prevent accidental DB drop\delete

This script trigger will help you to accidental DB drop/delete  Read more...
By Subhash Chandra 2018/11/05 | Source: SQLServerCentral.com | Category: drop
Rating: |  Discuss |   Briefcase | 426 reads

The Pesky Windows Power Plan Oh My

The below script will build a csv file for import of the servers Power Plan Setting.  Read more...
By Edward Pochinski 2018/11/06 | Source: SQLServerCentral.com | Category: administration
Rating: |  Discuss |   Briefcase | 257 reads


modernized sp_helpindex with info on post S2K features 
By Joe Chang 2018/10/29 | Source: SQLServerCentral.com | Category: indexing
Rating: |  Discuss |   Briefcase | 375 reads


extensions to sp_spaceused 
By Joe Chang 2018/10/24 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 437 reads

Mechanism To Dynamically Build Pivot Table

Script to build PIVOT queries with an arbitrary number of columns  Read more...
By Gaby Abed 2018/10/25 | Source: SQLServerCentral.com | Category: pivot table
Rating: |  Discuss |   Briefcase | 481 reads

View Server Roles and Permissions per Login

obtain server roles and permissions by login 
By Perry Whittle 2018/10/12 | Source: SQLServerCentral.com | Category: server roles
Rating: |  Discuss |   Briefcase | 422 reads
   Items 1 to 20 of 3546    Older >>