MemberNameColumn (Level Interface)
[!附註]
下一版的 Microsoft SQL Server 將不再提供此功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。
The MemberNameColumn property of the Level interface contains the name of the column that contains member names.
Applies To:clsAggregationLevel, clsCubeLevel, clsDatabaseLevel, clsPartitionLevel
Data Type
String
Access
Access depends on the value of the ClassType property of the object.
Class type |
Access |
---|---|
clsDatabaseLevel |
R/W* |
clsCubeLevel |
R |
clsPartitionLevel |
R |
clsAggregationLevel |
R |
* Read-only for virtual cube levels, levels with a LevelType property of levAll, and levels with a Grouping of groupingAutomatic.
備註
This property is useful when the member key column may not contain information recognizable to the user.
For example, a table may contain the columns SKU and Product_Name. When you generate queries by SKU number, you may want to display the corresponding product name for the sake of clarity. In this case, the member key column is SKU, but the member name column is Product_Name.
If you do not assign a value to MemberNameColumn, the Analysis server uses the MemberKeyColumn values for the member names.
Be careful when using expressions in MemberNameColumn that are based on columns other than those specified by MemberKeyColumn. Ensure that there is always a one-to-one correspondence in the values produced by the expressions in MemberNameColumn and MemberKeyColumn.
The MemberNameColumn property can contain any valid SQL expression involving one or more columns from the table that contains the member key column. Such an expression can be used to produce a calculated or concatenated string expression. For example, the following is a valid expression for a Product.Prod_Year member key column:
'Quarter ' & Format(DatePart('q',"Product"."Prod_Year"))
The following is another example from an Employees table:
"Employees"."LastName" + ', ' + "Employees"."Firstname"
[!附註]
If this property contains an SQL expression, the expression must be compatible with the SQL dialect supported by the OLE DB provider. Using an incompatible expression will result in an error when the cube is processed.
範例
Use the following code to set the MemberNameColumn property of a level object to the Product_Name column in table Sales:
' Assume an object (dsoLev) of ClassType clsLevel exists
dsoLev.MemberNameColumn = """Sales"".""Product_Name"""