Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    6

    Unanswered: DB2 table altering constraint error

    Whel we try to alter a table it says this operation cannot be done because of containts violation.

    actualy we hav to update a column datatype.

    Is there any method to disable this cheq and proceed.... rahter than disabling the dependencies.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    There is a way to turn off constraint checking for a table. Look at SET INTEGRITY.

    That being said, there is no way to change the datatype of a column, with the exception of making a varchar longer (and you do not have to turn off constraint checking unless there is a constraint on that column). The only way to get this accomplished is to:

    1) export the data
    2) drop the table
    3) recreate the table the desired way
    4) import the data
    5) reinstute the constraints on the table.

    Andy

  3. #3
    Join Date
    Oct 2003
    Posts
    6
    We hav done that Andy...

    thanks for the responce .. one more question .

    if there is a trigger or a procedure assosiated with that how do we accomplish this problem...

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The triggers will become invalid. They will need to be dropped and recreated before they become operable again.

    Stored Procedures depend on the version (I believe). Under V7 (UDB-LUW), I do not think there is anything you have to do (except maybe do some rewrite if the columns need different processing). In V8, you may have to recreate the SP, this is something I have not tried yet.

    Andy

    Originally posted by synap1974
    We hav done that Andy...

    thanks for the responce .. one more question .

    if there is a trigger or a procedure assosiated with that how do we accomplish this problem...

Posting Permissions

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