Re: Please Help
From: oj (nospam_ojngo@home.com)
Date: 01/14/03
- Next message: Sue Hoegemeier: "Re: Application roles Please Help!"
- Previous message: Sue Hoegemeier: "Re: Please Help"
- In reply to: David Lucus: "Please Help"
- Next in thread: Bob Barrows: "Re: Please Help"
- Reply: Bob Barrows: "Re: Please Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "oj" <nospam_ojngo@home.com> Date: Mon, 13 Jan 2003 20:06:05 -0800
here is how to do it without dynamic sql...
e.g.
use master
go
declare @role sysname, @user sysname
select @role='db_datareader',@user='abc'
--create new sql login
exec sp_addlogin @user,@user
--grant access to pubs db
exec pubs..sp_adduser @user
--add to pubs datareader role
exec pubs..sp_addrolemember @role,@user
--see if the security is set
exec pubs..sp_helpuser @user
-- -oj http://www.rac4sql.net "David Lucus" <davidl@studentlife.tamu.edu> wrote in message news:etA5uu0uCHA.2512@TK2MSFTNGP11... > I have a stored procedure that adds new sql server accounts from the web. > there are 2 databases that need teh login. The database where the stored > procedure resides has no problems granting roles and db access permissions, > however when i try to give it permissions to the other database nothing is > happening. It is not adding a user to the roles or throwing an error. here > is the code i am using to add the user to the second db > > EXECUTE DBName.dbo.sp_grantdbaccess @newname > > EXECUTE DBName.dbo.sp_addrolemember @sturolename, @newname > > where @newname is the variable with the name, and @sturolename is the role > name. > > if anyone has any ideas please help. > > thx, > David > >
- Next message: Sue Hoegemeier: "Re: Application roles Please Help!"
- Previous message: Sue Hoegemeier: "Re: Please Help"
- In reply to: David Lucus: "Please Help"
- Next in thread: Bob Barrows: "Re: Please Help"
- Reply: Bob Barrows: "Re: Please Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|