我想实现这样的设计
字段1 字段2 字段3 字段4
值 A 1 2 3
A 1 2 3
是允许的 字段1 字段2 字段3 字段4
A 1 2 3
A 1 2 4
是不允许的既当表中两H行记录的字段1内容相同时,字段2、3、4也必须是相同的,请问该如何定义呢?
字段1 字段2 字段3 字段4
值 A 1 2 3
A 1 2 3
是允许的 字段1 字段2 字段3 字段4
A 1 2 3
A 1 2 4
是不允许的既当表中两H行记录的字段1内容相同时,字段2、3、4也必须是相同的,请问该如何定义呢?
create trigger tr_check on table
for insert,update
as
begin
if exists (select * from table t ,inserted i where t.字段1=i.字段1 and t.字段2=i.字段2 and t.字段3=i.字段3 and t.字段4=i.字段4 )
raiserror ('违反了..',16,1)endend