Returns the value of the attribute in a specified context. get_appcontext is provided by the Application Context Facility (ACF).
get_appcontext (“context_name”, “attribute_name”)
select get_appcontext("CONTEXT1", "ATTR1")
-------------- VALUE1
select get_appcontext("CONTEXT2", "ATTR1")
select get_appcontext("CONTEXT1", "ATTR2", "VALUE1")
Select permission denied on built-in get_appcontext, database dbid ----------- -1
This function returns 0 for success and -1 for failure.
If the attribute you require does not exist in the application context, get_appcontext returns NULL.
get_appcontext saves attributes as char datatypes. If you are creating an access rule that compares the attribute value to other datatypes, the rule should convert the char data to the appropriate datatype.
All arguments for this function are required.
For more information on the ACF, see Row-Level Access Control in System Administration Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
The permission checks for get_appcontext differ based on your granular permissions settings.
Granular Permissions | Description |
---|---|
Enabled | With granular permissions enabled, you must have select permission on get_appcontext to execute the function. |
Disabled | With granular permissions disabled, you must have select permission on get_appcontext or be a user with sa_role to execute the function. |