SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 cannot add a user to a database
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jamie
Aged Yak Warrior

542 Posts

Posted - 01/12/2004 :  03:13:13  Show Profile  Reply with Quote
hello,
I am trying to add a user to a database but I get the error :
Error 15023: User or role 'abacus' already exists in the current database.
also, f I try to delete the user from sysusers table I get an error regarding cannot run ad hoc queries on system tables.

can anyone help ?
thanks,
Jamie

raymondpeacock
Constraint Violating Yak Guru

United Kingdom
367 Posts

Posted - 01/12/2004 :  05:15:24  Show Profile  Reply with Quote
Why are you trying to add a user that already exists? Has the database been restored from another server and the user ids are messed up? If so, try the sp_change_users_login stored proc with the 'auto_fix' parameter to sort out the login.

If that doesn't work you can update the system table, but it's not recommended. Use the sp_configure option to set the 'allow updates' option to 1.


Raymond
Go to Top of Page

nr
SQLTeam MVY

United Kingdom
12543 Posts

Posted - 01/12/2004 :  05:24:09  Show Profile  Visit nr's Homepage  Reply with Quote
Look at master..syslogins to find the user.
Now look at sysusers to find the user that is mapped to that login.
Use sp_dropuser to get rid of it.
Now you should be able to add the user.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jamie
Aged Yak Warrior

542 Posts

Posted - 01/12/2004 :  05:24:47  Show Profile  Reply with Quote
cheers Raymond, i've used the recommended sp and all is now fine !
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000