Results 1 to 5 of 5

Thread: delete records

  1. #1
    Join Date
    Jan 2004
    Posts
    2

    Unhappy Unanswered: delete records

    DBA2187E Failed to delete selected row(s).

    com.ibm.db.DataException: A database manager error occurred. : [IBM][CLI Driver][DB2/NT] SQL0532N A parent row cannot be deleted because the relationship "DB2SRV.A_VBHDR.FK_A_VBH_BCTBN" restricts the deletion. SQLSTATE=23504

    HELPPPPP?
    urgent
    TQ

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: delete records

    Type in

    db2 "? sql0532n"

    on your command line for help


    or

    download message reference manual from the db2 website www.ibm.com/db2/library

    Cheers
    Sathyaram


    Originally posted by Azrina
    DBA2187E Failed to delete selected row(s).

    com.ibm.db.DataException: A database manager error occurred. : [IBM][CLI Driver][DB2/NT] SQL0532N A parent row cannot be deleted because the relationship "DB2SRV.A_VBHDR.FK_A_VBH_BCTBN" restricts the deletion. SQLSTATE=23504

    HELPPPPP?
    urgent
    TQ
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jan 2004
    Posts
    2

    Re: delete records

    how to solve my problem? please help me....

    Originally posted by sathyaram_s
    Type in

    db2 "? sql0532n"

    on your command line for help


    or

    download message reference manual from the db2 website www.ibm.com/db2/library

    Cheers
    Sathyaram

  4. #4
    Join Date
    May 2003
    Location
    San Juan, PR
    Posts
    18
    Azrina, suppose you have 2 tables:
    ACCOUNT (Parent Table)
    ACCOUNT-TRANSACTION (Dependent Table, because every transaction must be associated to one account. To ensure this relation, an referential integrity rule without "cascade" option has been defined).
    To delete one row from ACCOUNT table, all the dependents rows in ACCOUNT_TRANSACTION must be deleted first. With "cascade" option, when parent row is deleted, all dependents rows are automaticly deleted too.

    I hoped this help you.

    Regards, ALF.

  5. #5
    Join Date
    Jan 2004
    Posts
    10
    Azrina,
    You could try this.

    drop the foreign key constraint first.
    "ALTER TABLE <child table name> DROP FOREIGN KEY DB2SRV.A_VBHDR.FK_A_VBH_BCTBN"

    recreate it with "on delete cascade"
    "ALTER TABLE <child table name> ADD CONSTRAINT DB2SRV.A_VBHDR.FK_A_VBH_BCTBN FOREIGN KEY (column names) REFERENCES <parent table name> (column names) ON DELETE CASCADE"

    Now, whenever the parent table data is deleted, the corresponding data in the child table would also be deleted.

    Hope this helps.
    thanks,
    prabhu.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •