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.
The cube for the current query context.
The identifier of the current database.
A reference to the connection object in the current context.
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.