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.
Author |
Topic |
itsonlyme4
Posting Yak Master
109 Posts |
Posted - 2008-01-07 : 09:00:31
|
Can anyone get me started on code to create a stored procedure to do the following on a SQL Server 20000 Instance: coding a stored procedure that will create a new NT authenticated login (if does not exist), then add the user to the DB, then insert the user to a table in the DB ? |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-07 : 09:21:31
|
use sp_grantlogin KH[spoiler]Time is always against us[/spoiler] |
 |
|
itsonlyme4
Posting Yak Master
109 Posts |
Posted - 2008-01-07 : 10:16:40
|
So I'd have to create the user Manually first and then create a stored procedure to do the Grantlogin AND add their record to a table in the DB?? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-07 : 10:22:32
|
this should be done at the Windows O/S and not SQL Server. KH[spoiler]Time is always against us[/spoiler] |
 |
|
itsonlyme4
Posting Yak Master
109 Posts |
Posted - 2008-01-08 : 10:35:30
|
I'm thinking XP_Grantlogin then SP_addrolemember then and insert to add this user to the table... but how do i automate this????? |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-08 : 10:41:44
|
what do you mean by automate it ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
itsonlyme4
Posting Yak Master
109 Posts |
Posted - 2008-01-08 : 10:44:48
|
Maybe automate is the wrong choice of words... I guess what I want to do is package it so it could be run ADHOC. |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-08 : 10:52:23
|
create a stored procedure and execute the xp_grantlogin & sp_addrolemember in it. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|