我有一个查询,我获取所有表和列名称,但如何获取特定表的列的数据类型和长度值?
SELECT [CATALOG_NAME] as [DATABASE],
CUBE_NAME AS [CUBE],[DIMENSION_UNIQUE_NAME] AS [DIMENSION],
LEVEL_CAPTION AS [ATTRIBUTE],
[LEVEL_NAME_SQL_COLUMN_NAME] AS [ATTRIBUTE_NAME_SQL_COLUMN_NAME],
[LEVEL_KEY_SQL_COLUMN_NAME] AS [ATTRIBUTE_KEY_SQL_COLUMN_NAME]
FROM $system.MDSchema_levels
WHERE CUBE_NAME ='Adventure Works'
AND level_origin=2
AND LEVEL_NAME <> '(All)'
order by [DIMENSION_UNIQUE_NAME]
答案 0 :(得分:0)
你的朋友是$SYSTEM.MDSCHEMA_PROPERTIES
。
查询可能有点像:
select [HIERARCHY_UNIQUE_NAME], [LEVEL_UNIQUE_NAME], DATA_TYPE
from $SYSTEM.MDSCHEMA_PROPERTIES
where [Dimension_Unique_Name] = '[Accident Cause]'
and [Property_Name] = 'MEMBER_VALUE'
and [CUBE_NAME] = 'Adventure Works'
要了解列DATA_TYPE
中的值的含义,请参阅此msdn link。