473,395 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SQL 2005 - SQLDMO - Adding Logins/ Users

I do not understand the sequence in which to add logins/users. A couple
of things to note. I can not use vbscript - it has to be done using the
sqldmo objects (or in a sql script).

The sequence I use now is:

1- create login, set default db
2- add login to sql server
3- set db owner
4- create user
5- add user to master db
6- add user to tempdb - blows up here
Error 'Microsoft SQL-DMO: [SQL-DMO]This object is already in a
collection.'

I need the user in 3 dbs. Any help greatly appreciated. Thinking about
it...I bet by adding it to the master db that it is automatically added
to tempdb so I will try to add it to the 2rd db and see if that works.

Thanks!
-Will

Jul 21 '06 #1
2 11300
Will (wm****@msn.com) writes:
I do not understand the sequence in which to add logins/users. A couple
of things to note. I can not use vbscript - it has to be done using the
sqldmo objects (or in a sql script).

The sequence I use now is:

1- create login, set default db
2- add login to sql server
3- set db owner
4- create user
5- add user to master db
6- add user to tempdb - blows up here
Error 'Microsoft SQL-DMO: [SQL-DMO]This object is already in a
collection.'

I need the user in 3 dbs. Any help greatly appreciated. Thinking about
it...I bet by adding it to the master db that it is automatically added
to tempdb so I will try to add it to the 2rd db and see if that works.
Permit me to be curious why you need to add the user to master and tempdb?
There is rarely any reason to do this, least of all in master.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 21 '06 #2
I don't know about the tempdb thing, but anytime I want to know how to
do something with script I'll just load up profiler and do it through
the GUI, then pick through the script and clean it up a bit.

Erland Sommarskog wrote:
Will (wm****@msn.com) writes:
I do not understand the sequence in which to add logins/users. A couple
of things to note. I can not use vbscript - it has to be done using the
sqldmo objects (or in a sql script).

The sequence I use now is:

1- create login, set default db
2- add login to sql server
3- set db owner
4- create user
5- add user to master db
6- add user to tempdb - blows up here
Error 'Microsoft SQL-DMO: [SQL-DMO]This object is already in a
collection.'

I need the user in 3 dbs. Any help greatly appreciated. Thinking about
it...I bet by adding it to the master db that it is automatically added
to tempdb so I will try to add it to the 2rd db and see if that works.

Permit me to be curious why you need to add the user to master and tempdb?
There is rarely any reason to do this, least of all in master.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jul 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mattsh | last post by:
I am having some issues adding user logins to SQL Server. When I search for users in Active Directory from Security->Logins->New Login, I can search for and add users using the short name...
3
by: mgPA | last post by:
Short: How can I limit the number of concurrent logins to Access (2000) DB? Long: I seem to be having the problem discussed in previous postings of having more than 9 or 10 concurrent logins. ...
2
by: Craig G | last post by:
i am currently building a small user maintenace system which works across different SQL db's and servers. for a logon screen i am using SQLDMO to get a list of all SQLServers on network, once...
2
by: Rico | last post by:
Hello, I have an ASP web app with an SQL back end. I am currently migrating to a new Windows 2003 Server machine and SQL Server 2005 Express. When I import the old database, I'm trying to...
2
by: Alex | last post by:
Hi, I am new to the mysteries of SQLDMO. I have written a program whereby the user can select which SQL server to connect to on the Network and this works fine. I am using the...
0
by: David | last post by:
Hi all, I must be going blind because i can not these options anywhere. We have a 2005 SQL Server running, what will become a live database asap. This is running currently within a domain....
1
by: bob66k88 | last post by:
What is the easiest way to move SQL Server 2005 databases from one old server to a new server?
3
by: Lee T. Hawkins | last post by:
I am having a number of problems over the last two full days trying to get an ASP.NET 2.0 application to connect to a SQL Server 2005 database... First off, I built this application w/ Visual...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.