Click here to monitor SSC
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

<< Newer    Items 41 to 60 of 3339    Older >>
 

Get Space on SQL hardrive

I was recently asked to monitor the Database size on the SQL server, and display the results in a report.   Read more...
By Kraai 2016/05/05 | Source: SQLServerCentral.com | Category: space on hardrive
Rating: |  Discuss |   Briefcase | 639 reads

Pad length

Pad string with a lenght of characters at front or back  Read more...
By Kraai 2016/04/28 | Source: SQLServerCentral.com | Category: string manipulation
Rating: |  Discuss |   Briefcase | 430 reads

Calculate Age (in years)

An inline table valued function (iTVF) that can be used to calculate age in years.  Read more...
By Alan Burstein 2016/04/27 | Source: SQLServerCentral.com | Category: date
Rating: |  Discuss |   Briefcase | 797 reads

Database File Move Etc

A stored procedure to generate database file moves along with Robocopy script and the attach / detach scripts  Read more...
By M Higgins 2016/04/20 | Source: SQLServerCentral.com | Category: attach
Rating: |  Discuss |   Briefcase | 454 reads

Version independent spGetBackupDateFromFile

This is an version independent stored procedure to get the backup date from a backup file. It's tested for SQL 2005, 2008(R2), 2012 and 2014. Consider it a template to which you can add more output parameters from the headerinfo to meet your requirements.  Read more...
By Theo Ekelmans 2016/04/21 | Source: SQLServerCentral.com | Category: restore headeronly
Rating: (not yet rated) |  Discuss |   Briefcase | 286 reads

Open Transaction Alarm to Log to the Event log

If you have job that opens a transaction and hangs too long causing a Prod issue this will be a big help to let you know.  Read more...
By Edward Pochinski 2016/04/22 | Source: SQLServerCentral.com | Category: transactions
Rating: |  Discuss |   Briefcase | 408 reads

Determine Easter Sunday

Determine what day easter sunday will be based upon the year you pass the function   Read more...
By Kraai 2016/04/25 | Source: SQLServerCentral.com | Category: easter sunday
Rating: (not yet rated) |  Discuss |   Briefcase | 356 reads

Format Date Time Function

Function do return common datatime formats of a date. select dbo.[KDT_FN_FORMATDATETIME]('LASTDAY DDDD',getdate())   Read more...
By Kraai 2016/04/26 | Source: SQLServerCentral.com | Category: datetime
Rating: |  Discuss |   Briefcase | 851 reads

GetNumsAB

A brand new, high-performing, "GetNumbers" or "fnTallyTable" function that can be used for defeating RBAR.  Read more...
By Alan Burstein 2016/04/19 | Source: SQLServerCentral.com | Category: set based
Rating: |  Discuss |   Briefcase | 653 reads

Counting

A fun, but simple tally table for April 1.  Read more...
By Steve Jones 2016/04/01 | Source: SQLServerCentral.com | Category: tally table
Rating: |  Discuss |   Briefcase | 725 reads

Find missing index in the whole instance

This script scans all DB-s in the instance & send result to the email. I use sp_MSforechdb function & missing index finding script what i found here https://technet.microsoft.com/en-us/magazine/jj128029.aspx   Read more...
By Aksel Rohtsalu 2016/03/28 | Source: SQLServerCentral.com | Category: missing index finder
Rating: |  Discuss |   Briefcase | 869 reads

AD HOC Queries with Excel Output (Multiple Instances)

From a plain text containing multiple instance names you can deploy EXCEL files to report just changing your query text  Read more...
Rating: |  Discuss |   Briefcase | 1,002 reads

CASE IN ORDER BY

sorting data based on a particular value.  Read more...
Rating: |  Discuss |   Briefcase | 290 reads

Post-Deployment - Scan for RefreshView/Recompile

A script I can run after deployment to refresh views and force a recompile due to modified DDL.  Read more...
By Nate Hughes 2016/03/18 | Source: SQLServerCentral.com | Category: deployment
Rating: (not yet rated) |  Discuss |   Briefcase | 423 reads

Resolving merge replication conflicts type 5 & 6

Merge replication conflicts 'upload insert failed' and 'download insert failed' cannot be resolved using Conflict Viewer alone. Here's a script that will semi-automate the process for most conflicts  Read more...
By Richard Rozema 2016/03/21 | Source: SQLServerCentral.com | Category: merge replication
Rating: (not yet rated) |  Discuss |   Briefcase | 297 reads

Transaction Log VLF Alarm

This was used to alert on VLF counts to high due to replication log reader having issue reading the transaction log.  Read more...
By Edward Pochinski 2016/03/17 | Source: SQLServerCentral.com | Category: transaction log
Rating: |  Discuss |   Briefcase | 662 reads

Script DB Level Permissions v4

Script database and object level permissions for all database users  Read more...
By S. Kusen 2016/03/22 | Source: SQLServerCentral.com | Category: login
Rating: |  Discuss |   Briefcase | 887 reads

End to End Server Disk Space reporting within SQL Server

This procedure using OLE object calls to obtain server disk space values and writes them to a table. It then creates an HTML report based on the contents of the table and then , via a SQL Agent job, sends out colour coded emails relating to how much drive space is left... this is very handy!!!!  Read more...
Rating: |  Discuss |   Briefcase | 849 reads

Part 2 -- Restore a database to another instance...

This script should be created in the source instance of the database to be backed up and then restored in conjunction with that on the destination in Step 1.  Read more...
By Haden Kingsland (theflyingdba) 2016/03/15 | Source: SQLServerCentral.com | Category: restore
Rating: (not yet rated) |  Discuss |   Briefcase | 470 reads

Part 1 -- Restore a database to another instance...

A great script that I wrote some time ago to allow the last database backup to be restored across a linked server to another server, after running a remote sproc on the destination to kill off any users on the receiving side.  Read more...
By Haden Kingsland (theflyingdba) 2016/03/14 | Source: SQLServerCentral.com | Category: scripts
Rating: |  Discuss |   Briefcase | 651 reads
<< Newer    Items 41 to 60 of 3339    Older >>