Re: Adding Logins
From: Jasper Smith (jasper_smith9@hotmail.com)
Date: 12/27/02
- Next message: Narayana Vyas Kondreddi: "Re: Adding Logins"
- Previous message: Brian: "Adding Logins"
- In reply to: Brian: "Adding Logins"
- Next in thread: Brian: "Re: Adding Logins"
- Reply: Brian: "Re: Adding Logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Jasper Smith" <jasper_smith9@hotmail.com> Date: Fri, 27 Dec 2002 20:01:59 -0000
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: Narayana Vyas Kondreddi: "Re: Adding Logins"
- Previous message: Brian: "Adding Logins"
- In reply to: Brian: "Adding Logins"
- Next in thread: Brian: "Re: Adding Logins"
- Reply: Brian: "Re: Adding Logins"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]