if not Exists(SELECT * FROM information_schema.tables where Table_name = 'SanadFormat') begin create table SanadFormat ( ID int Primary key, Dom_ID int references Domain(ID) not null , -- سند اموال، ضمانتنامه، ...؛ Dom_ID_Status int references Domain(ID) not null, -- فعال/غیرفعال Title nvarchar(500) ) end if not Exists(SELECT * FROM information_schema.tables where Table_name = 'SanadFormatDetail') begin create table SanadFormatDetail ( ID int Primary key, SF_ID int references SanadFormat(ID) not null, [Priority] int not null, Dom_ID_Status int references Domain(ID) not null, -- فعال/غیرفعال Title nvarchar(500), Body nvarchar(max) ) end