Create table (Firebird):
create table "AlternativeCode" ("ID" bigint not null, "AlternativeCode" varchar(100) not null, "Code1" varchar(2) not null, "Code2" varchar(2) not null, "Code3" varchar(2) not null, "Code4" varchar(2) not null, "Code5" varchar(2) not null, "Code6" varchar(2) not null, constraint "ConstraintID" primary key("ID"), constraint "ConstraintAlternativeCode1To6" unique("AlternativeCode", "Code1", "Code2", "Code3", "Code4", "Code5", "Code6"))
Existing data:
How can Macros BASIC get the event of error from trying to append repeated rows?
insert into "AlternativeCode" ("AlternativeCode", "Code1", "Code2", "Code3", "Code4", "Code5", "Code6") values ('S-0003', '02', '02', '02', '02', '02', '02')
If violating constraint then : Do something : End If
Or is there only one way, select and count the rowset
?
Learning_Firebird_CONSTRAINT.odb (3.4 KB)