在运用多维数据进行分析的时候,通常很有可能我们需要把这些多维数据脱机进行处理或演示,这其中就要用到cub文件,因此怎么生成CUB文件就成了关键,最近我做一个小项目用到了这个,也看了MSDN中的一个例子,感觉说的是不够详细,因此我就把自己写的一个简单MDX语句供给大家看一下:
CREATE GLOBAL CUBE [testStudy1]
Storage 'C:\localStudy.cub'
FROM [Test]
(
MEASURE [Test].[成绩],
DIMENSION [Test].[Time],
DIMENSION [Test].[Student]
)
其中create Glogbal cube 就不用多说了,
里面的testStudy1是要创建的新多维数据集的名称,
C:\localStudy.cub就是要创建的多维数据集的文件名及路径
Test就是新多维数据集所基于的多维数据集的名称。
下面的Measure就是新建的多维数据集中的度量值
Dimesion就是基于那些维度,这只是一个简单的例子,下面有Tim Peterson在MSDN论坛上的一个回答,希望对大家有所帮助。
We create AS2005 local cube files programmatically in CubeSlice like this:
1. We use the AMO Scripter to generate a Create ASSL script for the database.
2. We manipulate the script in a number of ways:
Removing unwanted cubes, dimensions, levels, measures, and other objects.
Slicing on particular members, if desired.
Switching to an Analysis Server source, if desired.
Manipulating the DataSourceView to reduce the size of the local cube, if desired.
Consolidating partitions, if necessary.
Taking care of other issues.
Batching the Create script together with a Process script.
3. We then use an ADOMD Cellset to create the local cube. The ASSL script is assigned as the Source of the Cellset. When the Cellset is opened the local cube is created.
There are a lot of things that need to be considered when creating local cube files. If you can use the script generated from the Scripter without modifications, it's not too difficult. If you want to minimize the size of your local cubes (which improves browsing performance) there's more work involved. We're trying to provide the choices to make it easy with our product, CubeSlice 9 (now in beta). We allow local cube creation to be scheduled using a command and parameters. We do not (not yet at least) provide an API to call our product.
We haven't fully documented all the ways we manipulate the ASSL script in creating the local cube. Our product exposes the script we use, so that you can examine how individual situations can be handled.
Tim Peterson