if not Exists(SELECT * FROM information_schema.tables where Table_name = 'Attachment') begin create table Attachment ( ID int Primary key, ATT_ID int references Attachment(ID) null, Dom_ID_AttachmentType int references domain(ID) not null, -- پرسنل - کالا ... Dom_ID_FileType int references domain (ID) not null, -- عکس، پوشه، ... Reference_ID bigint not null, Pro_ID_DB int references OtherProperties(ID) null, Title nvarchar(500), FilePath nvarchar(1000), [FileName] nvarchar(500), FileExtension nvarchar(100), Tarikh int null, [Description] nvarchar(1000), CodeKarbar int references Karbar(ID) not null, TarikhSabt int not null, SaatSabt smallint not null ) end go if not Exists(SELECT * FROM information_schema.tables where Table_name = 'AttachmentImag') begin create table AttachmentImag ( ID int Primary key, ATT_ID int not null, Value Image, ) end