if not Exists(SELECT * FROM information_schema.tables where Table_name = 'ContractHistory') begin create table ContractHistory ( ID int primary key, Con_ID int references Contract(id) null, CI_ID int references ContractItem(id) null, Dom_ID_RowType int references Domain(id) not null, -- سابقه هدر، آیتم Dom_ID_ActionType int references Domain(id) not null, -- اولیه، تمدید زمانی قرارداد ، تمدبد و ‌فزایش آیتم قرارداد، ابطال Tarikh int null, FromDate int null, ToDate int null, [Percent] float null, Quantity float null, Price decimal(19,4), Value nvarchar(max), Description nvarchar(max), Kar_ID_Creator int not null, TarikhSabt int not null, SaatSabt int not null ) end