Friday, March 23, 2012

generating sql logins

I've been given an excel file that lists:
userID's,
Names
Password
expiary dates.
I need to convert this list into sql server logins. Can this be done via a tsql statement? if so how, and if it cant be done via a statement then what other way can it be done.

Many thanks in advance.

Air:

I would probably use SSIS for this; however, you probably can also put together a script that uses BULK INSERT to get this done. This will be more simple if you can just ram and jam because none of these logins pre-exist.

Dave

|||

use master

declare @.loginame sysname

set @.loginame=N'DOMAIN\user'

exec sp_grantlogin @.loginame

exec sp_addsrvrolemember @.loginame, sysadmin

--

... most probably, NOT sysadmin, but whatever you need for that particular John or Jane Doe...

No comments:

Post a Comment