写triggercreate trigger ... on ...
for insert,update
as
if exists(select 字段 from 表 where 字段 is not null and 主键 in (select 主键 from inserted) group by 字段 having count(*)>1 )
rollback
for insert,update
as
if exists(select 字段 from 表 where 字段 is not null and 主键 in (select 主键 from inserted) group by 字段 having count(*)>1 )
rollback
for insert,update
as
if exists(select 要检查的字段 from 表 where isnull(字段,'')<>'' group by 要检查的字段 having count(*)>1 )
rollback