IF (NOT EXISTS (select Table_name from SysTable where LCase(Table_name)=LCase('PrintersPayCommands'))) THEN create table PrintersPayCommands( "N" integer not null default autoincrement, "Printer" varchar(50) not null, "PayType" integer not null, "Command" varchar(50) not null, primary key("N") ) END IF GO if (not exists (select Role from SysForeignKey where Lcase(Role)=LCase('PayType_Type'))) then ALTER TABLE PrintersPayCommands ADD NOT NULL FOREIGN KEY "PayType_Type" ("PayType") REFERENCES "PayTypes" ("PayTypeN") ON UPDATE CASCADE ON DELETE CASCADE end if go if (not exists (select Printer from PrintersPayCommands where LCase(Printer)=LCase('FP1000') and PayType = 4)) then insert into PrintersPayCommands (Printer, PayType, Command) values('FP1000', 4, 'N') end if go if (not exists (select Printer from PrintersPayCommands where LCase(Printer)=LCase('FP1000') and PayType = 1)) then insert into PrintersPayCommands (Printer, PayType, Command) values('FP1000', 1, 'P') end if go if (not exists (select Printer from PrintersPayCommands where LCase(Printer)=LCase('CBM262') and PayType = 4)) then insert into PrintersPayCommands (Printer, PayType, Command) values('CBM262', 4, 'N') end if go if (not exists (select Printer from PrintersPayCommands where LCase(Printer)=LCase('CBM262') and PayType = 1)) then insert into PrintersPayCommands (Printer, PayType, Command) values('CBM262', 1, 'P') end if go