Solved

Error 21770: Name not found in Users collection.

Posted on 1998-08-11
7
931 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

776 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