if not Exists(SELECT * FROM information_schema.tables where Table_name = 'StockTaking') begin create table StockTaking ( ID int primary key, Code int not null, FC_ID int references Finance_Cycle(ID) not null, Pro_ID_VahedMali int references OtherProperties(ID) not null, Pro_ID_Period int references OtherProperties(ID) not null, Pro_ID_Anbar int references OtherProperties(ID) not null, Title nvarchar(300), FromDate int not null, ToDate int not null, CodeKarbar int references karbar(ID) not null, TarikhSabt int not null, SaatSabt smallint not null ) end go if not Exists(SELECT * FROM information_schema.tables where Table_name = 'StockTakingItem') begin create table StockTakingItem ( ID int primary key identity (1,1), ST_ID int references StockTaking(ID) not null, Kal_ID int references kala(ID) not null, Dom_ID_KalaRestoration int references domain(ID) not null, Pro_ID_Vahed int references OtherProperties(ID) not null, Qunatity float not null, CodeKarbar int references karbar(ID) not null, TarikhSabt int not null, SaatSabt smallint not null ) end