Computed Values (M to SQL Mapping)
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
Computed Values in Microsoft code name “M” represent functions, expressions, or queries that can be reused.
“M”->SQL translates Computed Values into scalar functions, table-valued functions, or views, depending on their most probable usage in SQL (based on the return type and parameters to the function):
Scalar functions are created when the Computed Value return type is scalar, which allows you to use them like
SELECT Module.Function(2) + 1
.Views are created when the Computed Value has no parameters and the return type is an entity or a collection, which allows you to use them like
SELECT * FROM Module.View
.Table-valued functions are created when the Computed Value has parameters and the return type is an entity or a collection, which allows you to use them like
SELECT * FROM Module.Function(10)
.
Computed columns are not supported.
Examples
SQL tables for entities have columns of the same name as the entity fields as shown in the following table.
“M” Example | SQL Example | |
---|---|---|
View |
|
|
Scalar Function |
|
|
Scalar Function |
|
|
Table Valued Function |
|
|
“M”->SQL does not support entity and collection parameters to Computed Values. Only scalars are supported in parameters.