if not Exists(SELECT * FROM information_schema.tables where Table_name = 'Support') begin Create table Support ( ID int primary key, 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, Code int not null, Tarikh int not null, Dom_ID_Type int references Domain(ID) not null, -- نوع درخواست=> توسعه، پشتیبانی، رفع خطا Con_ID int references [Contract](ID) not null, -- قرارداد [Description] nvarchar(max) null, Kar_ID_Creator int references Karbar(ID) not null, TarikhSabt int not null, SaatSabt int not null ) end go if not Exists(SELECT * FROM information_schema.tables where Table_name = 'SupportItem') begin Create table SupportItem ( ID int primary key, Sup_ID int references Support(ID) not null, Dom_ID_Type int references Domain(ID) not null, -- تلفنی، اینترنتی، حضوری، ... Dom_ID_System int references Domain(ID) not null, -- سیستم => فروش، خرید، سند حسابداری، ... Tarikh int not null, DoneTime int not null, -- زمان صرف شده EmployerTime int not null, -- زمان کارفرما Response nvarchar(max) null, ResponseTechnical nvarchar(max) null, Kar_ID_Creator int references Karbar(ID) not null, TarikhSabt int not null, SaatSabt int not null ) end