if Exists(SELECT * FROM information_schema.tables where Table_name = 'Product') begin print 'true' end else begin create table Product ( ID int Primary key, Code int Not null, Dom_ID_Vaziat int references Domain (ID) not null, Kal_ID int references Kala(code) not null, Anb_ID int references Anbar(code) not null, Tarikh int not null, Tedad decimal(19,4) not null, Price decimal (19,4) not null, Sharh nvarchar(300), CodeKarbar int references Karbar(code) not null, TarikhSabt int not null, SaatSabt smallint not null ) end go --drop table ProductDetail if Exists(SELECT * FROM information_schema.tables where Table_name = 'ProductDetail') begin print 'true' end else begin create table ProductDetail ( ID int Primary key Identity(1,1), Prod_ID int references Product(ID) not null, Dom_ID_Noe int references Domain (ID) not null, Tarikh int not null, Kal_ID int references Kala(code) , Anb_ID int references Anbar(code), Pro_ID int references OtherProperties(ID) not null, Taf_ID bigint references Tafsili(code), Tedad decimal(19,4), Price decimal (19,4), Sharh nvarchar(300), CodeKarbar int references Karbar(code) not null, TarikhSabt int not null, SaatSabt smallint not null, Far_ID int references Farayand(code) , Taf_ID_Bestankar bigint references Tafsili(Code) ) end go