灵活应用inserted就行了 declare @key select 关键字=@key from inserted if exists(select a.字段 from tablename ,inserted i where a.字段=i.字段 and a.唯一索引<>i.唯一索引) return where 后面可灵活修改成你要效果
bbsftp(烨):我也是象你的方法做了。但是不管是发现重复值它都回滚。什么原因呢???
在使用insert 的时候判断一下该 值是否存在不就是了; if exists(select * from biao where 字段='aaaa') then begin
end else begin insert into biao (字段) values('aaaa') end;
declare @key
select 关键字=@key from inserted
if exists(select a.字段 from tablename ,inserted i where a.字段=i.字段 and a.唯一索引<>i.唯一索引) return
where 后面可灵活修改成你要效果
if exists(select * from biao where 字段='aaaa') then
begin
end
else
begin
insert into biao (字段) values('aaaa')
end;
bbsftp(烨):我也是象你的方法做了。但是不管是发现重复值它都回滚。什么原因呢???
---------------------------------------------
你的触发器代码贴出来看看,应该是条件判断错了