CREATE TRIGGER t_GROUPUSER ON dbo.GROUPUSER
FOR INSERT
AS
if (SELECT COUNT(*)
FROM GROUPUSER,inserted
WHERE (GROUPUSER.GROUPUSERID=inserted.GROUPUSERID)
AND (GROUPUSER.GROUPID=inserted.GROUPID)
AND (GROUPUSER.USERID=inserted.USERID)
AND (GROUPUSER.GROUPUSERNAME = inserted.GROUPUSERNAME) )>1
begin
print '记录已存在!'
rollback transaction
end