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)
 Create Users

Author  Topic 

fatherjack
Starting Member

3 Posts

Posted - 2004-07-26 : 05:50:47
Hi, I have to create over 300 SQL users for our new HR system, I am just getting VS.Net to write out the script for me but i am having trouble with the command to use.

Should i use
sp_addlogin, then sp_grantlogin, then sp_addrolemember , in order to create a brand new login and give it read / write access to the HR database ? If so, why am i getting an error saying:-
Error 21776: [SQL-DMO]The name 'bellj' was not found in the Users collection. If the name is a qualified name, use [] to seperate various parts of the name, and try again.

any help or suggestions greatly appreciated

n/a
deleted

35 Posts

Posted - 2004-07-26 : 11:00:02
Without seeing your code I can not say what is causing the error.

If you are using SQL Security then the following example is how to create the account and grant access to a database
use pubs
go
exec sp_addlogin
@loginame = 'testuser2',
@passwd = 'thisisapassword',
@defdb = 'pubs'
go
exec sp_grantdbaccess 'testuser2'



If you are using NT Integrated security then this is how it is done
use pubs
go
exec sp_grantlogin 'Corporate\TestUser1'
go
exec sp_grantdbaccess 'Corporate\TestUser1'


You only need to use the "role" stored procedures if you are adding your logins to SQL Roles.

HTH
Paul
Go to Top of Page
   

- Advertisement -