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

Trigger Based Change Data capture

This script capture INSERTs / UPDATEs / DELETEs on SQL Server table and logs to single table in JSON Format.  Read more...
By Ankush Parab 2017/12/01 | Source: SQLServerCentral.com | Category: cdc
Rating: |  Discuss |   Briefcase | 30 reads

Reporting by date - DateTrunc

A function to truncate datetimes to month, quarter, hour etc and their multiples for convenient grouping  Read more...
By Mike Tanner 2017/11/21 | Source: SQLServerCentral.com | Category: date manipulation
Rating: |  Discuss |   Briefcase | 267 reads

Read Only access to all databases to a user in a SQL Server Instance

Script to grant a SQL a user read-only access to all the databases in Server instance except the system databases and -- the Log shipped databases(if any : secondary :read-only)   Read more...
By Gaurav Deep Juneja 2017/11/22 | Source: SQLServerCentral.com | Category: security
Rating: |  Discuss |   Briefcase | 239 reads

Delete Change Tracking table data sys.syscommittab

With high transactions table the sys.syscommittab table does not gets deleted properly. Millions of backdated row remains. To delete the sys.syscommittab table below is the script.   Read more...
Rating: (not yet rated) |  Discuss |   Briefcase | 159 reads

Logshipping Report

Get Logshipping report only when secondary is more than certain time behind Primary.  Read more...
By Harikumar Mindi 2017/11/14 | Source: SQLServerCentral.com | Category: log shipping
Rating: (not yet rated) |  Discuss |   Briefcase | 171 reads

Script to send database consistancy errors

This script will run consistency check on database and send an email notification if it found any consistency errors.  Read more...
By Nisarg Upadhyay 2017/11/03 | Source: SQLServerCentral.com | Category: corruption
Rating: |  Discuss |   Briefcase | 287 reads

SQL Server procedure to script tables

SQL Server procedure to script all tables in a given database to one or individual files on a given path.  Read more...
By Gerrit Mantel 2017/10/09 | Source: SQLServerCentral.com | Category: create table
Rating: (not yet rated) |  Discuss |   Briefcase | 466 reads

Rebuild or recompile all views

Simple script to refresh or recompile your business-level views.  Read more...
By Doug Deneau 2017/10/05 | Source: SQLServerCentral.com | Category: views
Rating: |  Discuss |   Briefcase | 380 reads

Add new Databases to a AG Setup with PowerShell

Some short & sweet PS code to add databases on AG Node 1 to AG Node2 and snap them in.  Read more...
By Edward Pochinski 2017/09/12 | Source: SQLServerCentral.com | Category: availability groups
Rating: (not yet rated) |  Discuss |   Briefcase | 177 reads

Get SSAS Tabular Model (2016) Roles using Powershell `

Extract roles from 2016 Tabular Models using Powershell.   Read more...
By Thasigan Chetty 2017/09/14 | Source: SQLServerCentral.com | Category: powershell
Rating: (not yet rated) |  Discuss |   Briefcase | 110 reads

SQL Agent jobs that run SSIS packages

Lists the job names and package names for jobs that execute SSIS packages (for packages stored in msdb).  Read more...
By TD Knight 2017/09/13 | Source: SQLServerCentral.com | Category: sql agent
Rating: |  Discuss |   Briefcase | 454 reads

SQL Procedure for adding Database in existing Always-On HADR.

SQL Procedure for adding Database in existing Always-On HADR.  Read more...
Rating: |  Discuss |   Briefcase | 220 reads

CDC watchdog for databases in AlwaysOn AG

Stored procedure to ensure CDC job will be started once failover happen.  Read more...
By Emil Bialobrzeski 2017/08/25 | Source: SQLServerCentral.com | Category: cdc
Rating: |  Discuss |   Briefcase | 236 reads

ASCII ProperCase Function

Another ProperCase function that utilises the ASCII function  Read more...
By Simon Hundleby 2017/07/24 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 437 reads

Add a login to multiple SQL Servers

This is a simple powershell script that will add a particular login to multiple SQL Server instances in a go.   Read more...
By Vishnu Gupthan 2017/07/19 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 451 reads

Send Mail Task details from SSIS Package

This query will help you to fetch the information from Send Mail Task(To,CC,BCC,Subject) in SSIS packages.It also fetch the data for those tasks which are inactive.  Read more...
Rating: (not yet rated) |  Discuss |   Briefcase | 412 reads

XML import from a Cross-tab Report

Source xml is a rendition of a cross-tab report. I show the evolution of a Spackle solution for import as a SQL resultset.  Read more...
By Wayne Findley 2017/06/08 | Source: SQLServerCentral.com | Category: xml
Rating: |  Discuss |   Briefcase | 311 reads

Getting TEXT, NTEXT and IMAGE columns in Database

As per Microsoft documentation these types will be removed from future version   Read more...
By Sheraz Mirza 2017/06/02 | Source: SQLServerCentral.com
Rating: |  Discuss |   Briefcase | 341 reads

Function to Round or Truncate DateTime

This Function is used to round to Second, Minute, Hour or Day or to Truncate to Second, Minute, Hour, Day, Month or Year and return Datetime Value  Read more...
By Shane Clarke 2017/05/31 | Source: SQLServerCentral.com | Category: date manipulation
Rating: |  Discuss |   Briefcase | 506 reads
   Items 1 to 20 of 3453    Older >>