且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何找到 SSAS(表格模型)和 SQL 数据库之间的血统

更新时间:2022-06-22 22:48:47

对于兼容级别 1200 或更高的 Tabublar 模型,$SYSTEM.TMSCHEMA_PARTITIONS DMV 的 QueryDefinition 列将显示每个分区的源 SQL 语句,如果未分区,则显示整个维度/事实表.如果使用完整的表或视图名称(而不是查询),完整的 SELECT 语句将与对象名称一起显示.这可以通过连接到 SSAS 服务器并打开新的 MDX/DAX 查询窗口或其他工具(例如 Dax Studio)从任一 SSMS 进行查询.此 DMV 特定于您连接到的任何模型,而不是整个 SSAS 实例.在下面的示例中,Name 列是模型中维度的名称.由于 Name 是一个关键字,所以需要用括号括起来.

For compatibility level 1200 or above Tabublar models the QueryDefinition column of the $SYSTEM.TMSCHEMA_PARTITIONS DMV will show the source SQL statement for either each partition, or the entire dimension/fact table if it isn't partitioned. In the event that a full table or view name is used (instead of a query) the full SELECT statement will be displayed with the object name. This can be queried from either SSMS by connecting to the SSAS server and opening a new MDX/DAX query window or another tool such as Dax Studio. This DMV is specific to whatever model you're connected to, as opposed to the whole SSAS instance. In the example below the Name column is the name of the dimension from the model. Since Name is a keyword it will need to be enclosed in brackets.

SELECT QueryDefinition FROM $SYSTEM.TMSCHEMA_PARTITIONS WHERE [Name] = 'DimensionName'