看我写的这个触发器
刚用这玩意
大家看看效率上行不
CREATE TRIGGER ctrl_hl_embox ON dbo.hl_embox
FOR INSERT
AS
declare @uid int
while (select count(id) from hl_embox) >10
begin
select @uid = [uid] from inserted
delete from hl_embox where id = (select min(id) from hl_embox where uid=@uid)
if (select count(id) from hl_embox) <=10
break
else
continue
end