Anda dapat melakukannya melalui batasan CHECK,
Pertama Anda harus membuat tabel,
create table myTemp1(TempId int not null ,TransCode int,ReasonCode int);
dan kemudian tambahkan batasan sebagai
buat tabel myTemp1(TempId int not null ,TransCode int,ReasonCode int);
alter table myTemp1
add constraint check_role CHECK(case when (TransCode = 1 AND ReasonCode = NULL)
then 99 else ReasonCode end = ReasonCode);
ATAU suka
alter table myTemp1
add constraint check_role CHECK(ReasonCode = (case when (TransCode = 1 AND ReasonCode
= NULL) then 99 else ReasonCode end = 1))
demo di http://sqlfiddle.com/#!3/d633a/1