DynDeveloper.com

DynDeveloper.com

Sign Up Now! Log In
BenD 1/8/2015 9:30:22 AM

Drop a set of users from all databases

* This article, and all our great SQL (General) documentation, Is available on the SQL (General) menu

I love my job. Really.

I received this question via email today and it was so interesting that I decided to blog it.

One of our clients used to use pdk for timesheet entry but stopped several years ago. We now have over 100 users listed in sql under multiple databases that we’d like to remove. They all end with “_pdk”. Can you come up with an efficient way (more efficient than one at a time) to delete these SQL users and any related security records in each database?

 

Does anyone have an idea? Try and answer it before you look at my answer, see if yours is better.

Version: All
Section: SQL Scripts