if not Exists(SELECT * FROM information_schema.tables where Table_name = 'Account') begin create table Account ( ID int primary key, Code nvarchar(100)not null, Title nvarchar(1000) not null, Dom_ID_Status int not null, Description nvarchar(1000) null, Level1 int references AccountItem(ID) not null, Level2 int references AccountItem(ID) not null, Level3 int references AccountItem(ID) not null, Level4 int references AccountItem(ID) not null, Level5 int references AccountItem(ID) not null, Level6 int references AccountItem(ID) not null, CodeKarbar int references Karbar(ID) not null, TarikhSabt int not null, SaatSabt smallint not null ) end if not Exists(SELECT * FROM information_schema.tables where Table_name = 'Voucher') begin create table Voucher ( ID int primary key, Code int not null, Mat_ID bigint references Matter(ID) not null, FC_ID int references Finance_Cycle(ID) not null, Pro_ID_VahedMali int references otherProperties(ID) not null, Pro_ID_UsageType int references otherProperties(ID) not null, Pro_ID_Subject int references otherProperties(ID) not null, SubjectTitle nvarchar(1000), Dom_ID_Noe int references Domain(ID) not null, Dom_ID_Vaziat int references Domain(ID) not null, Dom_ID_Marja int references Domain(ID) not null, Tarikh int not null, Saat int not null, Description nvarchar(1000), CodeKarbar int references Karbar(ID) not null, TarikhSabt int not null, SaatSabt smallint not null ) end if not Exists(SELECT * FROM information_schema.tables where Table_name = 'VoucherItem') begin create table VoucherItem ( ID int primary key Identity(1,1), Vou_ID int references Voucher(ID) not null, Acc_ID int references Account(ID) not null, SerialNo int not null, Title nvarchar(1000), Debit decimal(19,4) not null, Credit decimal(19,4) not null, Refrence_ID bigint not null, Dom_ID_Marja int references Domain(ID) not null ) end if not Exists(SELECT * FROM information_schema.tables where Table_name = 'VoucherRefrenceID') begin create table VoucherRefrenceID ( ID int primary key Identity(1,1), Vou_ID int references Voucher(ID) not null, Bar_ID int references Bargeh(ID)null, DaryaftPardakht_ID int references DaryaftPardakht(ID) null, GardesheChek_ID int references GardesheChek(ID) null, Prod_ID int references Product(ID) null, KalDarAnbar_ID int references KalaDarAnbar(ID) null, Kal_ID int references Kala(ID) null, Taf_ID bigint references Tafsili(ID) null ) end