2013-12-23 59 views
0

我有一個週一運行雙週的SQL Server作業。我也有一個表和假期日期列表。我希望能夠在假期的任何一個星期一跳過我的工作,並在第二天執行該工作的迭代。在假期SQL Server 2008 R2作業重新安排

有關如何做到這一點的任何想法?

回答

0

星期一和星期二設置工作。

對於這份工作,開始與邏輯:爲方針

if (cast(getdate() as date) in (select days from holidaytable) and 
    datename(weekday, getdate()) = 'Monday' 
    ) or 
    (cast(getdate()-1 as date) not in (select days from holidaytable) and 
    datename(weekday, getdate()) = 'Tuesday' 
    ) 
begin 
    don't run the job now (whatever you want to do to log that) 
end; 
rest of the code for the job 
+0

完美,但我想重新創建工作,這是這麼多的清潔劑...謝謝 – user2129585