Senin, 01 November 2010
Execute T-SQL Code Only on Certain Days
I always clean up my databases manually on Sundays. But at times, if need be, I clean it up on other days as well. However I never do it on Saturdays, since the traffic is usually the most on that day. So here’s a simple tip using IF-ELSE to prevent my T-SQL code from running on Saturday’s, even if I run the code manuallyIF DATEPART(dw,GETDATE())<> 7 -- 7 is Saturday, 1 is SundayBEGIN -- YOUR
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar