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 3539    Older >>
 

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: alwayson
Rating: (not yet rated) |  Discuss |   Briefcase | 102 reads

Data Dictionary

I use this script to create data dictionaries.   Read more...
By Timothy Harms 2018/11/15 | Source: SQLServerCentral.com
Rating: (not yet rated) |  Discuss |   Briefcase | 42 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 | 179 reads

Parsing INTERNAL REPRESENTATION OF OVERPUNCH SIGNS

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 | 116 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 | 275 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 | 230 reads

sp_what

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 | 498 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 | 275 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 | 193 reads

sp_helpindex2

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

sp_spaceused2

extensions to sp_spaceused  Read more...
By Joe Chang 2018/10/24 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 310 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 | 330 reads

View Server Roles and Permissions per Login

obtain server roles and permissions by login  Read more...
By Perry Whittle 2018/10/12 | Source: SQLServerCentral.com | Category: server roles
Rating: |  Discuss |   Briefcase | 311 reads

How to Identify backup tables within production databases

How to identify backup tables within production databases that can be removed.   Read more...
Rating: |  Discuss |   Briefcase | 225 reads

Detect and Repair Non Trusted Foreign Keys

Create the code to detect and repair non trusted foreign keys  Read more...
By Ronald Hensbergen 2018/10/23 | Source: SQLServerCentral.com | Category: foreign keys
Rating: |  Discuss |   Briefcase | 188 reads

Purging table script

Script to purge big tables in small batches of 500  Read more...
By Abhishek Dwivedi 2018/09/26 | Source: SQLServerCentral.com | Category: purgingtable
Rating: (not yet rated) |  Discuss |   Briefcase | 79 reads

Conditionally Order By Different Column

Order records based on a different column depending on which absolute value is greater.  Read more...
By Noel Scheaffer 2018/10/01 | Source: SQLServerCentral.com | Category: t-sql
Rating: |  Discuss |   Briefcase | 371 reads

Data Collections restart and clear cache files

Script to stop the default Data Collection sets, clear the cache files and then restart collection sets.  Read more...
By Matt Frend 2018/10/02 | Source: SQLServerCentral.com | Category: data collections
Rating: (not yet rated) |  Discuss |   Briefcase | 128 reads

number of rows and columns of an instance

Get the number of rows, columns, and space used by all tables in all databases  Read more...
By Fabiano Carvalho 2018/10/03 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 226 reads

T-SQL to compress (shorten) IPv6 address

Didn't find anything, so hope this will help someone with similar need. Note I did a similar set-based version, and unless the input is more towards non-zeros in all eight 2-byte fields, the set-based performs not as well  Read more...
By jianqing_ye 2018/09/19 | Source: SQLServerCentral.com | Category: t-sql
Rating: (not yet rated) |  Discuss |   Briefcase | 186 reads
   Items 1 to 20 of 3539    Older >>