事实表没有填充数据

时间:2013-01-20 07:27:12

标签: sql

我正在尝试使用数据创建和填充三个维度和一个事实表。维度工作得很好,但我无法将任何数据存入我的事实表。如果有人会如此友善地指出我做错了什么 - 我将不胜感激。

非常感谢你。

create table Customer
(
    CUID integer identity(1,1) primary key,
    Name varchar (25)  
)
insert into Customer select distinct  customer  from [Data]

create table Agent
(
    AID integer identity(1,1) primary key,
    Agent varchar (25)  
)
insert into Agent select distinct Seller from [Data]

create table Time
(
    TID integer identity(1,1) primary key,
    Week varchar (25),
    Month varchar (25),
    Year int 
)
insert into Time
    (Week,Month,Year)
    select distinct Day,Month,Year from [Data]

Create Table Fact
(
    CUID integer,
    AID integer,
    TID integer,
    Sale money,
    constraint pk_Fact primary key (CUID, AID, TID),
    constraint fk1_Fact foreign key (CUID)
        references Customer (CUID),
    constraint fk2_Fact foreign key (AID)
        references Agent (AID),
    constraint fk3_Fact foreign key (TID)
        references Time (TID),
)
insert into Fact
    (CUID, AID, TID, Sale)
    SELECT CUID, AID, TID, Sale
        FROM Customer, 
             Agent,
             Time,
             [Data]

1 个答案:

答案 0 :(得分:0)

您需要处理多维数据集。在Visual Studio 2008中打开它并处理它。之后,数据将可见。您是否看到Dimension与度量的映射是否正确?