if Exists(SELECT * FROM information_schema.tables where Table_name = 'AnbarGardani') begin print 'true' end else begin create Table AnbarGardani ( Code int primary key identity(1,1), CodeBargeh int, Tarikh int not null, Sharh nvarchar(200), TarikhSabt int not null, SaatSabt smallint not null, CodeKarbar int foreign key references Karbar(code) not null, Vaziat smallInt not null, CodeFarayand int foreign key references Farayand(code), ) end go if Exists(SELECT * FROM information_schema.tables where Table_name = 'AnbarGardaniDetail') begin print 'true' end else begin create Table AnbarGardaniDetail ( Code int primary key identity(1,1), CodeAnbarGardani int foreign key references AnbarGardani(code) not null, CodeTafsili bigint foreign key references Tafsili(code) not null, Noe smallInt not null, CodeAnbar int foreign key references Anbar(code) not null, CodeKala int foreign key references Kala(code) not null, Tedad float not null, Mablagh decimal(19,4) not null, Mojoodi float not null, MojoodiVaghei float not null, ) end