Re: Adding Logins
From: Brian (bpstings6@attbi.com)
Date: 12/27/02
- Next message: paul reed: "Application Security"
- Previous message: BP Margolin: "Re: Adding Logins"
- In reply to: Jasper Smith: "Re: Adding Logins"
- Next in thread: Narayana Vyas Kondreddi: "Re: Adding Logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Brian" <bpstings6@attbi.com> Date: Fri, 27 Dec 2002 12:23:37 -0800
Thanks, I was close but couldn't figure out how my cursor
would get the values into sp_addlogin '@x' , '@y'
This line clinched it for me. (fetch next from lcur into
@id,@pass)
>-----Original Message-----
>Something like this should work :-
>
>declare @id sysname
>declare @pass sysname
>
>declare lcur cursor fast_forward for
>select [id],[password]
>from loginstable --your table name here
>
>open lcur
>
>fetch next from lcur into @id,@pass
>
>while @@fetch_status=0
>begin
>
>exec master..sp_addlogin @id,@pass
>
>fetch next from lcur into @id,@pass
>
>end
>close lcur
>deallocate lcur
>
>
>--
>HTH
>
>Jasper Smith (SQL Server MVP)
>
>I support PASS - the definitive, global
>community for SQL Server professionals -
>http://www.sqlpass.org
>
>"Brian" <bpstings6@attbi.com> wrote in message
>news:008a01c2addd$fa85de10$d6f82ecf@TK2MSFTNGXA13...
>> I need to add 300 new sql id to my server. I have the
list
>> in sql table, - 2 columns, id and pw. Versus adding
eaach
>> one individually, I wanted to create a script to read
the
>> table row by row and create the logins and be done. I
>> tried using a cursor to go row by row, but had trouble.
>> Any thoughts or site I might visit to get more info or
>> find an already exisitng script?
>>
>> Thnks, Brian
>
>
>.
>
- Next message: paul reed: "Application Security"
- Previous message: BP Margolin: "Re: Adding Logins"
- In reply to: Jasper Smith: "Re: Adding Logins"
- Next in thread: Narayana Vyas Kondreddi: "Re: Adding Logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|