ALTER  trigger latest_time     
on bill for update              
as   
if update(stateID)                
begin
declare daysell cursor for   --创建一个名为daysell的只读游标
select  billID from inserted
for read only
declare @billID bigint    --声明变量
open daysell                 --打开游标
fetch daysell                 --从游标取一行数据
into @billID
while(@@fetch_status=0)      --是否处理完所有行记录
begin
update goods        
 set latest= getdate()        
 where billID=@billID
fetch  daysell              
into @billID
end
end