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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Approle

Author  Topic 

psangeetha
Yak Posting Veteran

95 Posts

Posted - 2010-08-04 : 08:42:06
Hi friends,

I need some help to create an application role for the QA database and grant this role 'read only' on few tables for specific users. This users when they login via application, this role will be enabled.

I created the application role on management studio as below:

create APPLICATION ROLE test WITH PASSWORD ='password1' , DEFAULT_SCHEMA = dbo;

When I try to set the approle, I get this error

EXEC sp_setapprole 'test', 'password1'

Msg 15161, Level 16, State 1, Procedure sp_setapprole, Line 46
Cannot set application role 'test' because it does not exist or the password is incorrect.

When I right click on the approle 'test' properties, and select a schema owned by this role, when I go back to the properties again the schema is checked but I'm not able to uncheck it and select a different schema..

Any suggestions please? I'm not sure if I'm doing this right.. I also searched in msdn to see if there is any step by step procedure to accomplish this but I cant find it..

Thanks much

psangeetha
Yak Posting Veteran

95 Posts

Posted - 2010-08-05 : 14:46:20
I got it to work.. But I'm having a different problem now..

create APPLICATION ROLE test WITH PASSWORD ='password1' , DEFAULT_SCHEMA = dbo;

EXEC sp_setapprole 'test', 'password1'

I'm able to create and exec the approle test successfully. In a new session, when I right click on properties in the approle test, I selected 'aris' under Owned schemas and clicked ok. But from another session or from the same session, when I right click on approle test, I'm not able to uncheck 'aris' schema.. IS it not possible to change the owned schemas in the approle?

Thanks
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2010-08-17 : 10:08:14
once you've invoked the approle, the session takes on the security context of the approle...

you need to open a new session to execute whatever it is you are doing, outside the security context of the approle

hope that helps

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -