Accessing Query Context in Stored Procedures


Applies To: SQL Server 2016 Preview

The execution context of a stored procedure is available within the code of the stored procedure as the Context object of the ADOMD.NET server object model. This is a read-only context and cannot be modified by the stored procedure. The following properties are available on this object.

CurrentCubeCubeThe cube for the current query context.
CurrentDatabaseNameStringThe identifier of the current database.
CurrentConnectionConnectionA reference to the connection object in the current context.
PassIntegerThe pass number for the current context.

The Context object exists when the Multidimensional Expressions (MDX) object model is used in a stored procedure. It is not available when the MDX object model is used on a client. The Context object is not explicitly passed to or returned by the stored procedure. It is available during the execution of the stored procedure.

Multidimensional Model Assemblies Management
Defining Stored Procedures

Community Additions