Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Enable/Disable a constraint?
Mon, Mar 9 2020 6:06 PMPermanent Link

Ian Branch

Avatar

Hi Team,
Can I enable/disable a table constraint at run time?
If so, how pls?
Regards & TIA,
Ian
Tue, Mar 10 2020 2:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Not as far as I know. You can enable/disable triggers though if that's any help.

I did have one sneaky thought but I'm not sure how I could get it to work - it will depend on the constraint. Can you post it here please.

Roy Lambert
Tue, Mar 10 2020 4:50 AMPermanent Link

Ian Branch

Avatar

Hi Roy,
Her you go.  I have others but if one can work then I should be able to make it work on the others.
{sql}
ALTER TABLE "Models"
ADD CONSTRAINT "ModelsDupCheck" UNIQUE ("Manufacturer","MODEL","ModelNo") ERROR CODE 10007 MESSAGE ''Data Entry Error!
The Manufacturer, Model and Model Number combination is already present in the Models table!''
{sql}

Regards,
Ian
Tue, Mar 10 2020 5:17 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


My sneaky idea won't even get off the ground - a UNIQUE constraint is basically doing an index lookup - no way to fudge that. There is a flag for EMPTY TABLE (IGNORE CONSTRAINTS) so something might be doable - you'll have to ask Tim for the feature.


Roy Lambert
Tue, Mar 10 2020 5:36 AMPermanent Link

Ian Branch

Avatar

Cheers & Tks for looking.
Image