October 23, 2007 at 7:09 am
How can I delete a bunch of users at the same time from sys.sysusers table in SQL Server 20005 users database?
October 23, 2007 at 7:25 am
i think your stuck with simply generating the statements as a batch, and then running them:
like this:
select'exec sp_dropuser '''+ name + '''' as SQLSTMT, * from sys.sysusers where uid > 3 and uid < 16000
--or
select'exec sp_droplogin '''+ name + '''' as SQLSTMT, * from sys.sysusers where uid > 6 and uid < 16000
Lowell
October 23, 2007 at 7:53 am
- I think you should post in sql2005 (sys.sysusers)
- be carefull with users being actual dbowner !
- be carefull with users owning objects in databases
- Indeed you need to handle the db-users and the serverlogins separatly.
Generate your statements !
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
October 23, 2007 at 8:00 am
Yes.. The above mentioned answers are right. But ensure to have the backup of sysusers table before truncating and adding the values. Take a script of the table and run through the process.
October 23, 2007 at 8:02 am
Thank you guys! The script works.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply