Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 2.24 KB

using-stored-procedures-mdx.md

File metadata and controls

40 lines (30 loc) · 2.24 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic ms.custom
Using Stored Procedures (MDX)
Using Stored Procedures (MDX)
kfollis
kfollis
kfollis
02/17/2022
sql
analysis-services
reference
mdx

Using Stored Procedures (MDX)

You can extend the functionality of [!INCLUDEssASnoversion] and Multidimensional Expressions (MDX) by writing .NET stored procedures or user-defined functions. For more information, see ADOMD.NET Server Programming

When you reference or call a stored procedure, you specify the function name followed by parentheses. Within the parentheses, you can specify expressions called arguments that provide the data to be passed into the parameters. When you call a function, you must supply argument values for all of the parameters, and you must specify the argument values in the same sequence in which the parameters are defined in the user-defined function.

The following example query assumes that you have an assembly named SampleAssembly registered on your [!INCLUDEssASnoversion] Server:

SELECT SampleAssembly.RandomSample([Geography].[State-Province].Members, 5) on ROWS,   
[Date].[Calendar].[Calendar Year] on COLUMNS  
FROM [Adventure Works]  
WHERE [Measures].[Reseller Freight Cost]  

Note

Stored procedure is the terminology used in [!INCLUDEssASnoversion] for these types of functions. Earlier versions of [!INCLUDEssASnoversion] called these types of functions as user-defined functions.

Types of stored procedures

[!INCLUDEssASnoversion] supports both COM and CLR assemblies. CLR assemblies are recommended because of the enhanced security available to CLR assemblies. If Microsoft Office Excel is installed on the server, Excel functions are also available.

Note

Microsoft Visual Basic for Applications (VBA) COM Assemblies are registered automatically.

See Also

Functions (MDX Syntax)