Sp_adduser is pefectly happy to take a domain user's name as an argument.
Also there is sp_grantdbaccess which is probably better to use, because
sp_adduser is slated for demolition. Here is a BOL example of using
sp_grantdbaccess with a domain user:
EXEC sp_grantdbaccess 'Corporate\GeorgeW', 'Georgie'
As you can see from the command syntax, you don't have to worry about any
passwords. Also, I believe that if you are using domain accounts, you don't
need to use sp_addlogin, because it create SQL accounts, and you do not
really have to have both.
-----Original Message-----
From: Guzman [mailto:mssqldba-ezmlmshield-x29533516.[Email address protected]
Sent: Tuesday, May 30, 2006 7:38 PM
To: LazyDBA Discussion
Subject: Adding a new login
I would like to add a new user to my server and database through stored
procedures, and I know it can be done, but how?
I've been playing with the master database sp_addlogin, then thought I
would run sp_addUser after that, but how do you add a login for a
trusted connection? I don't have the password, because I just import
them from the domain. Which sp do I use to import from a domain?
Running sp_adduser should work after that.
Dan
------------------------------------------------------------------
Daniel Guzman
Western Coastal EMAP Data Manager
Computer Sciences Corporation, c/o U.S. EPA
Coastal Ecology Branch
2111 S.E. Marine Science Center Drive
Newport OR 97365-5260
(541)867-5033, FAX (541)867-4049
---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
MS Sql Server LazyDBA home page