if not exists(SELECT column_name from sys.syscolumn sc join sys.systable st on sc.table_id = st.table_id where LCase(table_name) = LCase('RegFunctions') and LCase(column_name) = LCase('ftype')) then alter table RegFunctions add "ftype" integer default 1; end if; go IF not (EXISTS(Select * from sys.systable where LCase(table_name) = LCase('FuncType'))) THEN create table FuncType( "id" integer not null default autoincrement, "descr" varchar(100) not null, primary key ("id") ); insert into FuncType(id, descr) values(1, 'Декодираща'); insert into FuncType(id, descr) values(2, 'След download'); insert into RegFunctions(name, ftype) values('DeleteSalesAfterImport', 2); END IF; go if not exists(select * from SvoObjects where N = 32) then insert into SvoObjects(N, Ime, Opisanie, DanTip, Syzdatel, Active) values(32, 'Функция след download', 'Функция която ще се изпълни след download в базата, от която се сваля', 'V', 1, 1) end if;