create trigger generate_flightInformation after datepart(hour,getdate())=0 on flightInformation as ... 这是我写的代码,但是分析说after附近发生错误。 麻烦高手指点 ---------------------------------------------- create trigger generate_flightInformation on flightInformation after update,insert as你要的內容
用after 是可以的,但后面的条件是放在触发器的主体中,即as 后, after 是说明对何种动作触发,可以是 update,insert,delete中的一种或多种,可改为 as if datepart(hour,getdate())=0 begin ... end 如果只是按时间不伴随动作,可用事务来实现你的功能
after datepart(hour,getdate())=0
on flightInformation
as
...
这是我写的代码,但是分析说after附近发生错误。
麻烦高手指点
----------------------------------------------
create trigger generate_flightInformation on flightInformation
after update,insert
as你要的內容
after 是说明对何种动作触发,可以是 update,insert,delete中的一种或多种,可改为
as
if datepart(hour,getdate())=0
begin
...
end
如果只是按时间不伴随动作,可用事务来实现你的功能
其实我想在日期变更的时候,就向flightinformation表中insert一些数据。请问应该如何实现呢?是用事务还是存储过程呢?麻烦具体写一下语句,谢谢!!
用作业
调度每天0点执行