simple problem regarding relationship...

  • this is my diagram http://aspspider.net/vhalexxs/relationship.jpg

    here is the error while saving the diagram...

    'rco_prodattr' table saved successfully

    'rco_prodacc' table

    - Unable to create relationship 'FK_rco_prodacc_rco_prodattr1'. 

    Introducing FOREIGN KEY constraint 'FK_rco_prodacc_rco_prodattr1' on table 'rco_prodacc' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

    Could not create constraint. See previous errors.

    is there a way to create a constrain with cascade delete and update on rco_prodacc, or if not what will be the best possible solution for this.

     

     

    thanks....

  • This was removed by the editor as SPAM

  • Hello Alex..

    The syntax for this exists in SQL Server 2005 and can be found at this BOL link: (ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/54ca1d10-5106-4340-bde4-480b83e7e813.htm).  Here's an excerpt:

    By using cascading referential integrity constraints, you can define the actions that the SQL Server 2005 takes when a user triesto delete or update a key to which existing foreign keys point.

    The REFERENCES clauses of the CREATE TABLE and ALTER TABLE statements support the ON DELETE and ON UPDATE clauses:

    • [ ON DELETE { NO ACTION | CASCADE | SET NULL | SET DEFAULT } ]
    • [ ON UPDATE { NO ACTION | CASCADE | SET NULL | SET DEFAULT } ]

    NO ACTION is the default if ON DELETE or ON UPDATE is not specified.

    ON DELETE NO ACTION

    Specifies that if an attempt is made to delete a row with a key referenced by foreign keys in existing rows in other tables, an error is raised and the DELETE statement is rolled back.

    ON UPDATE NO ACTION

    Specifies that if an attempt is made to update a key value in a row whose key is referenced by foreign keys in existing rows in other tables, an error is raised and the UPDATE statement is rolled back.

    I hope this help you.  Please write back on my blog or here if there's anything else I can do to help.

       - Ward Pond


    Take care..

    - Ward Pond
    blogs.technet.com/wardpond

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

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