December 8, 2008 at 8:25 am
My requirement is to subtract 7 days from the the date passed as
parameter if it matches with my Holiday date table subtract 8 days and
pass that value other wise pass the Original value.
Behind story :My job picks up data from Previous week and runs.In one
of the cases the previous week was a holiday .So due to lack of data
that Job failed.What we decided is whenever there is a holiday
Pickup the previous day of that week.
Ex:If 27 th isa holiday we need to pickup 26 th.
December 8, 2008 at 8:33 am
DECLARE @OriginalDate DATETIME
SET @OriginalDate = dateadd(dd,datediff(dd, 0, getdate()), 0)
IF EXISTS (SELECT 1 FROM dbo.HolidayTable WHERE HolidayDate = @OriginalDate)
SET @OriginalDate = DATEADD(dd, -1, @OriginalDate)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
December 8, 2008 at 8:38 am
IF ((SELECT a.holidaydate FROM holidays a WHERE a.holidaydate = @datepassed-7) IS NOT NULL)
SET @datereturn = @datepassed-8
ELSE SET @datereturn = @datepassed-7
December 8, 2008 at 11:09 am
How to rewrite this block in Oracle?.
December 8, 2008 at 1:20 pm
Sirish (12/8/2008)
How to rewrite this block in Oracle?.
Sorry, no idea. This is the SQL Server 2005 (T-SQL) section of the forum.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply