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.
|CurrentCube||Cube||The cube for the current query context.|
|CurrentDatabaseName||String||The identifier of the current database.|
|CurrentConnection||Connection||A reference to the connection object in the current context.|
|Pass||Integer||The 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.