If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 table altering constraint error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-03, 09:12
synap1974 synap1974 is offline
Registered User
 
Join Date: Oct 2003
Posts: 6
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.
Reply With Quote
  #2 (permalink)  
Old 10-14-03, 09:56
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #3 (permalink)  
Old 10-14-03, 09:59
synap1974 synap1974 is offline
Registered User
 
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...
Reply With Quote
  #4 (permalink)  
Old 10-14-03, 10:07
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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

Quote:
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...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On