Wednesday, March 7, 2012

Application Role status

Is there a way to determine if an existing connection has invoked a specific
application role? I need to know so that I don't re-invoke it and get an
error.Hi
If you are doing this within your application then why don't you set a
boolean (class attribute) ?
If you try to set the application role a second time you will get an error
return code and Msg 2762
John
"Stefano Nicolini" wrote:

> Is there a way to determine if an existing connection has invoked a specif
ic
> application role? I need to know so that I don't re-invoke it and get an
> error.
>
>|||Yes, you can check this using the USER_NAME() function. The following
T-SQL activates the approle on the connection if it is not already
activated:
IF (SELECT USER_NAME()) <> 'ApproleName'
EXEC sp_setapprole 'ApproleName', 'password'
--Mary
On Mon, 18 Apr 2005 15:12:27 -0400, "Stefano Nicolini"
<StefanoN@.infotronics.com> wrote:

>Is there a way to determine if an existing connection has invoked a specifi
c
>application role? I need to know so that I don't re-invoke it and get an
>error.
>

No comments:

Post a Comment