if not Exists(SELECT * FROM information_schema.tables where Table_name = 'AccountHeaderDependency') begin ------------------ جدول ارتباط معین با سرفصل ها create table dbo.AccountHeaderDependency ( ID int primary key, Mat_ID bigint references dbo.Matter(ID) not null, Dom_ID_RowType int references dbo.Domain(ID) not null, -- اتصال شده به معین - آزاد AH_ID int references dbo.AccountHeader(ID) not null, AI_ID int references dbo.AccountItem(ID) not null, -- سیستمی - غیرسیستمی ) end