Solved

Error 21770: Name not found in Users collection.

Posted on 1998-08-11
7
933 Views
Last Modified: 2008-02-01
When I add a login to SQL Server using the sp_addlogin
SP, and then go in through the Enterprise Manager to
add that login to a predefined group, I get the error
"Error 21770: The name 'VDnwid' was not found in Users
collection" I cannot add this login to a group.
What should I be doing here?
 
0
Comment
Question by:vd
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:connex
ID: 1089533
how exactly to you add the login? (give sp_addlogin line)
This worked fine for me till now

0
 

Author Comment

by:vd
ID: 1089534
Thanks. Here's the line:

isql /U sa /P %1 /S %2 /Q "sp_addlogin %3, %4, %5"

This is obviously executed in a .bat file.
%1 is the sa password; %2 is the server; %3 is the login to be
added; %4 is the password for this login; %5 is the default database for this new login.
0
 
LVL 2

Accepted Solution

by:
connex earned 50 total points
ID: 1089535
Ah thats it :)
You need to call sp_adduser as well.
The sp_addlogin just makes a new entry in the master database about a new login but does not assign it to a db.
just call for the database you want to give the user access

sp_adduser <login_id>[,<username>[,<groupname>]]



0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:vd
ID: 1089536
Thankyou!
0
 

Author Comment

by:vd
ID: 1089537
I added the sp_adduser statement to my procedure (.bat file)
and I still get the same error!
0
 
LVL 2

Expert Comment

by:connex
ID: 1089538
So you do now:

use master
sp_addlogin test
go
use mydb
sp_adduser test
go

Yes?

0
 

Author Comment

by:vd
ID: 1089539
Thanks. That seems to work.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question