Hello Everyone,
In my stored procedure I want a block to do nothing if its Sunday or Monday but do its regular "inserts and updates" for rest of the days in the week. I have done some thing that gets the work done, but it doesn't seem to be a clean way to do it. Is there a better way to do it. Here is what I did,
Create procedure MyStoredProc
AS
BEGIN
... ... ...
... ... ...
declare @today varchar(10)
set @today = DATENAME(DW,GETDATE())
;
IF @today = 'Sunday' OR @today = 'Monday'
BEGIN
PRINT 'No Update Required'
END;
ELSE
BEGIN
... ... ...
"My Regular Inserts and Updates"
... ... ...
END
I am avoiding the regular updates and inserts on Sundays and Mondays by simply allowing my script to go to somewhere else not absolutely required for it to go to - here printing the message 'No Update Required'. I would rather not print this message if I can.
Is there a better/cleaner way to handle this type of situation? Any suggestions and recommendations highly appreciated.
Thanks.