create trigger tr_tb
on tb
for insert,update,delete
asupdate ta
set [count]=(select count(*) from tb where taid=ta.id)
from (select taid from inserted union select taid from deleted) as t
where ta.id=t.taid
go--注意:这个触发器效率不怎么样