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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Error 21776 - Unable to create user by script

Author  Topic 

pszivos
Starting Member

10 Posts

Posted - 2006-02-28 : 03:09:07
Dear Fellows!

I have a problem running a series of commands to create an NT user under MS SQL2000. I have read other threads, but found no answer.

After running the following commands:

-- Creating and setting up the login...
SET QUOTED_IDENTIFIER OFF
USE Users
EXECUTE sp_grantlogin N'domain\user'
EXECUTE sp_defaultlanguage N'domain\user', N'us_english'
EXECUTE sp_defaultdb N'domain\user', N'Users'
USE master
GO

-- Creating Database User/Group...
USE mydatabase
EXECUTE sp_grantdbaccess N'domain\user', N'domain\user'

If I go to Enterprise MAnager, I can see the user/login created and the database assigned, but I am not able to modify it. I get the following error:

Error 21776: [SQL-DMO]The name'....' was not found in the Users collection...

The owner of mydatabase is dbo.

Do you have any ideas?

Thanks in advance!

pszivos
Starting Member

10 Posts

Posted - 2006-02-28 : 08:19:43
In the meantime I found the answer. It is so banal. It is not enough to do a refresh in the logins, but you have to do it in the database/users also... Incredible!
Go to Top of Page
   

- Advertisement -