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: )

896 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: )

1,044 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: )

850 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: )

652 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: )

653 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: )

804 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

398 reads

Blogs

Logical crossroads in Azure Data Factory (IF and Filter operations)

By

(2021-Jan-19) I was raised listening and reading fairy tales where the main character would reach...

Storage Tiers What SQL Server DBAs Need to Know

By

“One Gerbil, Two Gerbils or Three Gerbils?” is a common DBA joke about server...

Synapse Analytics and .NET for Apache Spark Example 3 - CTE()

By

The next example is how to do a CTE (Common Table Expression). When creating...

Read the latest Blogs

Forums

Reversing a String in Python

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Reversing a String in Python

Group By and JOIN within SQL Server (when dealing with multiple columns)

By lynhudson1

I have 2 tables, df1, and df2. I would like to join the two...

Select "New Customer"

By gjoelson 29755

Hi , Has anyone tried to do this...I'm trying to select only "new customers"...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers