Scripts

Technical Article

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.

1 (1)

You rated this post out of 5. Change rating

2020-03-23 (first published: )

1,513 reads

Technical Article

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 […]

You rated this post out of 5. Change rating

2020-03-16 (first published: )

1,170 reads

Technical Article

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)

You rated this post out of 5. Change rating

2020-03-05 (first published: )

1,138 reads

Technical Article

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)

You rated this post out of 5. Change rating

2020-01-17

3,475 reads

Technical Article

T-SQL script to purge all the tables including foreign key references

T-SQL script to purge all the tables including foreign key references. The script has been made smart enough to use TRUNCATE wherever there is no foreign key reference and to use DELETE wherever there is foreign key reference.

5 (3)

You rated this post out of 5. Change rating

2019-12-10

2,489 reads

Blogs

Simple Talks Episode 9–Data masking and subsetting

By

The episode on data masking and subetting is out. You can see it here:...

T-SQL Tuesday #180: Avoid Perfect for Good Enough

By

I'm listening to Effortless by Greg McKeon (link to author's page) through Audible.com. He...

Book Review – Humanizing Data Strategy by Tiankai Feng

By

This book was making its rounds on social media, and the concept seems interesting...

Read the latest Blogs

Forums

SQL server help (converting rows to columns)

By don075

I am using the following sql to convert rows into columns for each pid,...

Ingesting Data From REST API endpoints: Data Engineering with Fabric

By John Miner

Comments posted to this topic are about the item Ingesting Data From REST API...

Separate Reads

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Separate Reads

Visit the forum

Question of the Day

The Hash Join I

What are the two inputs called to a hash join operation in SQL Server? (choose 2)

See possible answers