2015-04-24 2 views

ответ

12

Вы можете установить check constraint:

constraint [check_abc] check (([A] is null and [B] is null and [C] is null) or 
           ([A] is not null and [B] is not null and [C] is not null)) 
1

Вы могли бы также рассмотреть факторинг эти связанные столбцы, чтобы второй таблицы, в которой они объявлены not null и только вставить строку, в которой они применяются.

create table dbo.Table1( 
    Id int not null primary key 
) 


create table dbo.Table2( 
    Id int not null primary key references Table1, 
    A int not null, 
    B int not null, 
    C nvarchar (4000) not null 
) 
Смежные вопросы