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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 cannot add a user to a database

Author  Topic 

Aged Yak Warrior

542 Posts

Posted - 2004-01-12 : 03:13:13
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

367 Posts

Posted - 2004-01-12 : 05:15:24
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


12543 Posts

Posted - 2004-01-12 : 05:24:09
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 - 2004-01-12 : 05:24:47
cheers Raymond, i've used the recommended sp and all is now fine !
Go to Top of Page

- Advertisement -