Scripts

Unused Indexes

This script will provide a list of indexes that are not used in a database. Indexes are overhead and any indexes not being used but are being updated cause additional load on a database. This looks at the following  items: User seeks, scans and lookups. If all three of these are zero and the User […]

2020-04-21 (first published: )

789 reads

Missing index script

This script on missing indexes that SQL had found. SQL will track queries and provide suggestions on indexes it feels will provide improvements. You should not take this information and create all the indexes. Performance tuning can be an art and takes practice. This information should be reviewed and as a DBA implemented a little […]

2020-04-20 (first published: )

950 reads

Calculating Easter in SQL

Several months ago someone commented on a calendar thread that you should not even try to calculate Easter in SQL Server because the math was too hard.  That got me to thinking and I decided to see if that was actually the case. I found that there are several well known algorithms available - but […]

2020-04-06 (first published: )

767 reads

Select Group Members from Logins

Know who all the individual group members are for a given WINDOWS_GROUP login. This script uses the sys.xp_logininfo procedure to find group members for each login on an instance. This is useful when attempting to remove orphaned WINDOWS_LOGINS. May have issues working across your logged in domain.

2020-03-23 (first published: )

604 reads

Orphaned Users Search and Destroy

This script will find all orphaned users on all databases on an instance, and generate a script to drop each user. Simply execute, copy the values from the DropScript column to a new SSMS window and execute. There are two risks with this script. Use with caution: This script attempts to take into account users […]

2020-03-16 (first published: )

613 reads

String Search

The script searches through every column of every record in a database to find a value. It works with numbers too. Simply assign a value to @MyString. Indicate what datatype(s) you wish to search through, and indicate if you want wildcards, and execute. The search is smart and will only search through columns where @MyString is […]

3 (3)

2020-03-05 (first published: )

762 reads

Amazon RDS SQL Server - Drop Database with Mirroring

Dropping database in RDS follows different method than dropping the database in local SQL Server. Below is the command to DROP the database in Amazon RDS EXECUTE msdb.dbo.rds_drop_database N'demodb' GO However when the SQL Server is configured with Multi-zone mirroring, then you need to set the partner to OFF and drop all active connections and […]

5 (1)

2020-01-17

273 reads

Blogs

Welcome to 3Cloud …

By

A little over a month ago, Pragmatic Works Consulting was a part of a...

Daily Coping 23 Oct 2020

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

One Thousand SQL Saturdays (*ish)

By

This weekend is SQL Saturday #1000, running virtually from Oregon. It’s a good schedule,...

Read the latest Blogs

Forums

How to get these description from XML into the table?

By NewDBA201

  I want all these description in different row. TIA Example descriptions 0|Home 1|Office|False...

Need help to form query to get missing month data

By anuxps

I want to know what are the customers having missing month data based on...

What would cause slow disk access on an AWS EBS SQL Server? (PAGELATCHIO_SH)

By apresley

I have an EC2 instance (r5a.4xlarge) which should be able to do 2Gbps+ in...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers