Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Delete All Database User Accounts for a Given Server Login


Delete All Database User Accounts for a Given Server Login

Author
Message
hakim.ali
hakim.ali
Right there with Babe
Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)

Group: General Forum Members
Points: 772 Visits: 1031
Comments posted to this topic are about the item Delete All Database User Accounts for a Given Server Login

Hakim Ali
www.sqlzen.com
Prat!K
Prat!K
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 26
This is good topic but I want to delete 2 users forcefully from 253 databases then how can i do it?
hakim.ali
hakim.ali
Right there with Babe
Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)Right there with Babe (772 reputation)

Group: General Forum Members
Points: 772 Visits: 1031
Prat!K (4/14/2014)
This is good topic but I want to delete 2 users forcefully from 253 databases then how can i do it?


Towards the top of my script there is this line:

set @LoginName = 'LOGIN_NAME_HERE'

Set the server level login name associated with one of your users here, and run the script. Then set @LoginName to the login name of your other user, and run the script again. This will accomplish what you want. I'm assuming these two users and the 253 databases are on the same server. If they are on more than one server, just repeat the process on each server.

Hakim Ali
www.sqlzen.com
Iwas Bornready
Iwas Bornready
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11978 Visits: 885
Great script, thanks.
SQL-DBA-01
SQL-DBA-01
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3075 Visits: 3217
Nice Script. If anyone do not want to drop the user just change that to "Select" so that you can check what are the results before droping the user.




select @sql = 'use [' + DB + ']; select user [' + UserName + ']'



Thanks.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search