if not Exists(SELECT * FROM information_schema.tables where Table_name = 'Prescription') begin create table Prescription ( ID int primary key, Code int not null, Mat_ID bigint References Matter(ID) not null, Pre_ID int References Prescription(ID) null, Taf_ID bigint References tafsili(ID) not null, Pro_ID_Type int References OtherProperties(ID) not null, -- نوع حکم => ترفیع سالیانه، افزایش جذب و ... IssueDate int not null, StartDate int not null, EndDate int not null, Description nvarchar(1000), Kar_ID_Creator int References Karbar(ID) not null, TarikhSabt int not null, SaatSabt int not null ) end ; if not Exists(SELECT * FROM information_schema.tables where Table_name = 'PrescriptionDetail') begin create table PrescriptionDetail ( ID int primary key, Pre_ID int References Prescription(ID) not null, PF_ID int References PrescriptionFormula(ID) not null, Value decimal(19,4) not null ) end