How do you handle update and delete rules for fact tables?

I have a fact table with a composite key of 5 columns. Two of the columns are FKs to the date dimension. I was setting the delete/update rules for the FK relationship in SSMS and it had a problem with me creating cascade action on the FKs that connected
to the date dimension.
What is the proper way to set up FK relationships in fact tables with SSMS when  you have composite keys as most fact tables do?

Yeah I understand all that. What I'm trying to do is to protect my database from RI violations that occur by production support people blowing away stuff in a dimension table but forgetting to blow away related records in the fact table. I want those fact
records deleted automatically so we don't have orphan records which was a real issue at a previous engagement. Production support is usually just people that know SQL and some relational modeling. It's not too likely they will understand the details of dimensional
modeling enough such that they would know that they had to blow away the fact record first.
My problem is I have a FK to a role playing dimension (the date dimension in this case). So basically I have to columns in the fact table that have a FK relationship to the PK of the date dimension. When I create both relationships SSMS and try to have both
of them cascade delete SSMS has an issue with it.
The error I get is:
Unable to create relationship '[relationship name]'
Introducing Foreign Key constraint '[constraint name]' on table '[table name]' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other foreign key constraints.
I can go ahead and put no action and the table will save fine. The question now becomes how does the cascade delete actually work. Can I just set one part of the key to cascade delete?
Actually I just realized that this is an even bigger design issue. What DOES happen to a fact record when one of it's dimensions gets deleted and I've got full RI set up on the table?
Or am I totally thinking about this wrong. Do you set up cascade deletes in a dimensional model? Is there a way to prevent deletes from the dimension table if there are related fact records?

Similar Messages

  • How to perform insert, update and delete in a table component

    hi all,
    i am using a table component in my page. I want to retreive data from multiple tables as well as perform insertion, updation and deletion operation.The changes should be affected in the corresponding tables. can anyone provide a solution for my problem.
    Thanks in advance
    regards,
    prasant

    There is a great tutorial for insert, update and delete records in a table.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Hope it helps.
    Thanks,
    Moumita

  • HT201320 how do you set up and exchange account for google mail

    how do you set up and exchange account for google mail

    If it's a free gmail account, you don't. Google no longer permits free accounts to be set up using Exchange Active Sync. Only paid google apps accounts can be set up as Exchange accounts.

  • How do you setup audible and visual notification for 2 hours elapsing?...

    How do you setup audible and visual notification for 2 hours elapsing?... on the iMac desktop Apple computer OS X 10.6.8 Snow Leopard.

    You can set the calendar to notify you of an event and then have subsequent alerts at 2 hour intervals.  A bit clumsy but would work.

  • Insert,update and delete data in a table using webdynpro for abap

    Dear All,
    I have a requirement to create a table allowing the user to add rows in it and update a row as well as delete a row from that table.To do this I guess I have to make use of ALV.But using ALV I am not able to enter data to a table where as I can make a column editable delete a row etc. please guide me to perform these operations(insert,update and delete) on table.
    Thanks,
    Reddy.

    Hi Sridhar,
    By using ALV you can do all insert delete etc things. if you want to edit i mean you can yenter data in ALV.
    Check this...
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1
    Editing alv in web dynpro
    editing rows in alv reports
    Re: editing rows and columns in alv reports in webdynpro abap
    Cheers,
    Kris.

  • How do you handle date and time in a global implementation

    Hello:
    Does somebody have a strategy on handling date and time in a global environment? Does Oracle timestamp it based on the Time Zone it is in? If so, if I have a distributed data architecture and data is getting replicated across these sites that are in different time zones, how does it handle the situation?
    Thanks.
    venki

    There are a variety of TIMESTAMP data types-- TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE. TIMESTAMP WITH TIME ZONE or TIMESTAMP WITH LOCAL TIME ZONE will probably work for you. If you are going to display the data to a user, however, TIMESTAMP WITH LOCAL TIME ZONE is probably the best option since it automatically converts to the local time zone. If you just have application code that is looking at the timestamps, either one will work.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How do you uninstall mail and delete associated files?

    I just find the mail application annoying and I never use it.  I'd like to clear out any application I dont use to free up space on my hard disk ... How do I do this?

    The mail app only takes up a very tiny amount of space - 60.4mb for the application itself.  I don't think it is worth deleting and I would advise against it.  But if you insist..
    I haven't tried this myself, but this is what I found while searching:
    Drag Mail.app to the trash and delete it.
    use AppZapper which will find everything related to Mail.app and delete it too.
    got to Home > Library > Preferences and delete the file "com.apple.mail.plist".
    Then go to Home > Library and delete the folder called "Mail". That should get rid of the last traces.

  • How can I insert, modify and delete entries on my table control?

    Hi,
    I already have build a table control. Now I want to make manipulations on it. Therefore I have created 3 buttons, insert, modify and delete. But how can I get actions on table control.
    This is my code for the internal table:
    BEGIN OF its OCCURS 0,
    mark TYPE C VALUE ' ',
    artikel_nr TYPE ZARTIKEL-ARTIKEL_NR,
    artikel_typ TYPE ZARTIKEL-TYPE,
    bezeichnung TYPE ZARTIKEL-BEZEICHNUNG,
    preis TYPE ZARTIKEL-PREIS,
    mwst TYPE ZARTIKEL-MWST,
    END OF its.
    and this is the code which i wanted to  delete a row in my table control:
    WHEN 'DELETE'.
    LOOP AT its WHERE mark EQ 'X'.
    DELETE its WHERE mark = 'X'.
    MOVE its TO ZARTIKEL.
    ENDLOOP.
    ENDCASE.
    ENDMODULE:
    and my PBO and PAI:
    PROCESS BEFORE OUTPUT.
    LOOP AT its INTO ZARTIKEL WITH CONTROL ARTIKEL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE EXIT.
    LOOP AT its.
    MODULE V1.
    ENDLOOP.
    MODULE user_command_1060.
    But if I now open my table control and mark the line that I wanted to delete, nothing happens, not on my internal table and the data even not deleted on my table ZARTIKEL. Have you an idea what I did wrong??

    Hi,
    In the attributes of table control take the SELCOL as wa_zekpo-flag
    And in the internal table and work area add a field as flag(1) TYPE c
    Refer:
    At screen logic:-
    PROCESS BEFORE OUTPUT.
      MODULE status_8002.
      LOOP WITH CONTROL po_tab.
        MODULE pass_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
      MODULE function.
    In PBO,
    MODULE status_8002 OUTPUT.
      SET PF-STATUS 'ZTG_SELTB'.
      DATA : line_count TYPE i.
      DESCRIBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 5.
    ENDMODULE.                 " STATUS_8002  OUTPUT
    *&      Module  PASS_DATA  OUTPUT
    MODULE pass_data OUTPUT.
      READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
    ENDMODULE.                 " PASS_DATA  OUTPUT
    In PAI,
    *&      Module  USER_COMMAND_8002  INPUT
    MODULE USER_COMMAND_8002 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 8001.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_8002  INPUT
    *&      Module  MODIFY_DATA  INPUT
    MODULE DISPLAY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  FUNCTION  INPUT
    MODULE FUNCTION INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'SELECT'. "<--select all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = 'X'.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DESEL'. "<--deselect all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = ' '.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DELETE'.
          DELETE FROM it_ekpo WHERE flag = 'X'.
      ENDCASE.
    ENDMODULE.                 " FUNCTION  INPUT
    Regards,
    Tarun

  • How to get any update and delete happening in database

    Hi,
        I need to capture the insert, delete and update operation performed by AD group users in the database. How i can capture it ?

    You can use SQL Server
    audit in case, if you have Enterprise Edition of SQL Server and can live with extra overhead it introduces.
    Alternatively, you can create your own solution with Extended Events.
    Finally, you can consider to develop AFTER UPDATE/DELETE triggers on the critical tables and perform audit programmatically. Keep in mind, that AFTER triggers affect performance and introduce index
    fragmentation. 
    Thank you!
    Dmitri V. Korotkevitch (MVP, MCM, MCPD)
    My blog: http://aboutsqlserver.com

  • Ipod Touch Mail:  How do you select all and delete?

    Hello,
    I recently decided to start using the mail app on my Ipod Touch. I found the "edit" button for deleting emails, but can't figure out how to select all.
    Can anyone tell me how to select all of the messages so i don't have to do it individually?
    Thanks

    Axel Foley wrote:
    at 539 I would recommend doing that on your PC when you can. I do understand that it is a hassle when one has a full inbox to move/delete. Now if all of those were in the Trash bin then it is a different story.
    Good Luck.
    Axel F.
    So you can do it from a mac? while synced or something?
    That was the 1st thing I tried, but I couldn't find the files to delete. I'll check it out again.
    Thanks for your help.

  • Handling update and insert in a database table

    Hi guys,
    I have some data in a database table which I created.Every day some new records come into the table.what i want is that if the account no of the new record which comes say today already exists in the table hen I do not insert a new record but only update the value field related to the account no.
    Being more explicit:
    say my table has two columns
    acc no        value.
    10                3500
    Now as for the existing account no 10 say a new value 300 comes in I want that a new field is not created rather the value is made to 3500+300.
    and if an accno 20 comes which is not there in table a new row is aded for that.
    Any suggestions would be appreciated.
    Thanks

    Hi
    you can do the following way.
    report ztest.
    data: begin of itab occurs 0,
            accno type char10,
            value type i,
          end of itab.
    data: it_acc like itab occurs 0 with header line,
          it_acc1 like itab occurs 0 with header line.
    Assume already value in itab.
    select *
      into table it_acc
      from zacc
        for all entries in table itab.
    where accno eq itab-accno.
    loop at it_acc.
      collect it_acc to it_acc1.
    endloop.
    loop at itab.
      collect itab to it_acc1.
    endloop.
    modify zacc from table it_acc1.
    Reward points, if it is useful.
    Regards
    Raja.
    Edited by: Ravindra Raja on May 28, 2008 5:38 PM

  • Implementing Conditional Insert, Update, and Delete Allows for View Objects

    Steve,
    Thanks for the info in this article it was very helpful. I have one question as I created a test case that used dept & emp tables as master and detail.
    Placing code in the emp detail ViewRowImpl that also tests to see if the master is updateable and it all works fine but I noticed that when you run it in the tester the dept master fields are grayed out but not the emp details and if you bring up the emp detail with out the view link then they are grayed out.
    Just wondering is this just a fact of the detail being shown in a table in the master detail and not a form or is there more to it then that??

    yes as follows:
    isMasterUpdateable checks the Dept table to see if it is updateable before allowing emp to be updated.
    public boolean isAttributeUpdateable(int index)
    if ( isMasterUpdateable() == true )
    return ( super.isAttributeUpdateable(index) );
    return(false);
    When I run this in the tester the results are correct except for the visual where the form is grayed out but the detail in the table is not. Should the table gray out also or is this effect something that must be coded in all Jtables that i may implement? If it needs to be coded to get the effect where does Jtable check for isAttributeUpdateable ?
    thanks,

  • How do you get L and R Wavs for mastering?

    Greetings all,
    My friend works in a recording studio and offered to do some discounted mastering for my tracks that I did.. The only thing he wanted was each project bounced to L and R wavs... I've looked around on and it looks like this is actually something that people do -- its common in ProTools.  Anyone know a way for me to do this or something similar??
    Thanks!!!

    Me too.  We want to mix my Garage band tracks with pro tools

  • How about a major update, and free itunes for us??

    come on steve,, give us something???

    I really think a major upgrade would help smooth some of this over.

  • Insert row and delete row in a table control

    Hi Experts,
    I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
    Thanks in Advance....

    Santhosh,
    Iam using this code..
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    -BEGIN OF LOCAL DATA----
      DATA l_table_name       LIKE feld-name.
    data: p_mark_name type c.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    -END OF LOCAL DATA----
      ASSIGN (p_tc_name) TO <tc>.
    get the table, which belongs to the tc                               *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    delete marked lines                                                  *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
      access to the component 'FLAG' of the table header                 *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
        PERFORM f_save_confirmation_9101.
        IF gv_answer EQ '1'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
          ELSE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    in this code   ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
    this code is not working...

Maybe you are looking for