Nulls in Time dimensions?

  • Can you have a null in the key column of the fact table time dimension i am getting an error when i try to process the cube. It appears to try to convertt he nulls into zero and then "cant find the attributkey" This only happens when the dimension is defined as a time dimension the cube processed fine when i dont define it as a time dimension.

    here is some test cde that will build and populate the fact and dim tables. The cube based on these two tables with the time dimension explicitly defined (in the cube builder wizard.) will process fine untill you insert the null commented out at the bottom. Uncomment this and reprocess the cube and it will error.

    Anyone know why this is. Surely you can have nullable time dimensions?

     

    if

    object_id('DateDim') is not null

    drop

    table DateDim

    go

    if

    object_id('datefact') is not null

    drop

    table datefact

    go

    create

    table DateDim

    (

    ID int identity, date smalldatetime)

    go

    insert

    DateDim

    select

    getdate()

    union

    all

    select

    getdate()+1

    union

    all

    select

    getdate() +2

    union

    all

    select

    getdate() +3

    union

    all

    select

    getdate() +4

    union

    all

    select

    getdate() +5

    create

    table datefact

    (

    id int identity, datekey int , amount int)

    go

    insert

    datefact

    select

    1, 50

    union

    all

    select

    1, 50

    union

    all

    select

    3, 50

    union

    all

    select

    4, 50

    union

    all

    select

    5, 50

    union

    all

    select

    5, 50

    /*--Uncomment this so a null is insert into the time dimension reprocess the cube and it will error

    union all

    select null, 50

    */

     

    www.sql-library.com[/url]

  • Jules,

    The only way I could find to get around this was to set up a Custom Error Configuration that allows the cube to be processed in the same manner as in SQL 2000.

    To do this:

    1. Open the Cube Stucture Tab
    2. Select the Cube
    3. Open the properties
    4. Click on Error Configuration
    5. Select Custom
    6. Set 'KeyNotFound' to ReportAndContinue

    When you process the cube this should just report that the key's have been converted to unknown member.

    Hope this works for you.

    Ged.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply