Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Aged Yak Warrior

542 Posts

Posted - 01/12/2004 :  03:13:13  Show Profile  Reply with Quote
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 ?

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.

Go to Top of Page


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

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  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000