|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Hello...
Can anybody help me with the following problem I'm experiencing with MS SQL server 2000. I recently attached an old database to my new server using the script : EXEC sp_attach_db @dbname = N'requisite', @filename1 = N'W:\database\data\reqel.mdf', @filename2 = N'W:\database\data\reqel.ldf' However during this process no login name was created for the database user(s). I tried creating this user but kept getting the following error: error 21002: [SQL-DEMO]User ' reqel' already exists. I can't delete the existing database user because this user is the owner of several database tables. Does anyone know how I can resolve this issue??? Thanks in advance Jammy |
|
#2
|
|||
|
|||
|
Hallo everyone,
I have found the solution to this problem. So for those of you who might be experiencing the same problem. Here is the solution: Steps To Resolve Orphaned Users Run the following command for the orphaned user from the preceding step: Use Northwind go sp_change_users_login 'update_one', 'test', 'test' This relinks the server login "test" with the the Northwind database user "test". The sp_change_users_login stored procedure can also perform an update of all orphaned users with the "auto_fix" parameter but this is not recommended because SQL Server attempts to match logins and users by name. For most cases this works; however, if the wrong login is associated with a user, a user may have incorrect permissions. After you run the code in the preceding step, the user can access the database. The user may then alter the password with the sp_password stored procedure: Use master go sp_password NULL, 'ok', 'test' This stored procedure cannot be used for Microsoft Windows NT security accounts. Users connecting to a SQL Server server through their Windows NT network account are authenticated by Windows NT; therefore, their passwords can only be changed in Windows NT. Only members of the sysadmin role can change the password for another user's login. |
|
#3
|
|||
|
|||
|
YOU are the man!
I'm helping someone else out with some SQL Server 2000 stuff and got stuck on the Error 21002. I did a google and came across your posting and solution. Your solution did the trick and I was able to appreciate. FWIW, thank you very much! Guess the truth is out there... |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Problem adding SQL users to database. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|