get_appcontext

Description

Returns the value of the attribute in a specified context. get_appcontext is provided by the Application Context Facility (ACF).

Syntax

get_appcontext (“context_name”, “attribute_name”)

Parameters

context_name

is a row specifying an application context name, saved as datatype char(30).

attribute_name

is a row specifying an application context attribute name, saved as char(30).

Examples

Example 1

Shows VALUE1 returned for ATTR1.

select get_appcontext("CONTEXT1", "ATTR1")
--------------
VALUE1

ATTR1 does not exist in CONTEXT2:

select get_appcontext("CONTEXT2", "ATTR1")

Example 2

Shows the result when a user without appropriate permissions attempts to get the application context.

select get_appcontext("CONTEXT1", "ATTR2", "VALUE1")
Select permission denied on built-in get_appcontext, database dbid
-----------
-1

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for get_appcontext differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must have select permission on get_appcontext to execute the function.

Granular permissions disabled

With granular permissions disabled, you must have select permission on get_appcontext or be a user with sa_role to execute the function.

See also

For more information on the ACF, see “Row-level access control” in Chapter 11, “Managing User Permissions” of the System Administration Guide.

Functions get_appcontext, list_appcontext, rm_appcontext, set_appcontext