Check constraint in appian MYSQL database


I wonder if it is possible to apply check constraint in appian database? 

Secondly, can it be possible to update the values in a table column based on the values in second column in the same table?

  Discussion posts and replies are publicly visible

Parents Reply
  • You will get this error, when the table already has some data and fails to qualify the check constraint requirements. Try to fix the data first and then create the check constraint.

    I was able to re-produce the issue by following the scripts below

    CREATE TABLE Persons (
        ID int NOT NULL,
        LastName varchar(255) NOT NULL,
        FirstName varchar(255),
        Age int,
        City varchar(255),
        PRIMARY Key (ID)
    INSERT INTO `Persons` (`ID`, `LastName`, `FirstName`, `Age`, `City`) VALUES ('10', 'Test', 'Test', '17', 'Test');
    ALTER TABLE Persons ADD CONSTRAINT CHK_PersonAge CHECK (Age>=18); 
    -- This will throw the error message as you mentioned
    -- Fix the data by using the blow query and create check constraint
    UPDATE `Persons` SET `Age` = '18' WHERE `Persons`.`ID` = 10;
    ALTER TABLE Persons ADD CONSTRAINT CHK_PersonAge CHECK (Age>=18); 

No Data