April 28, 2008 at 11:39 am
I am creating a bunch of jobs that restore our prod dbs to our test and deve environments nightly. I'd like to include in that job a step that drops all users and their permissions, then the following step would grant only permissions to the users that need it on test and dev.
My question is - Is there any way to drop all users without having to specify each user. I know I can say sp_dropuser 'Bob'
sp_dropuser 'Tom'
But I would rather just run one that would drop all. Is there anything I can use? Thanks!
Thanks!
April 28, 2008 at 2:38 pm
How about
SELECT * FROM sys.sysusers WHERE uid>5 AND SUBSTRING(name,1,2)<>'db'
April 28, 2008 at 2:46 pm
I would recommend sp_revokedbaccess rather sp_dropuser
---------------------------------------------------------------------
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy