I'm sure this is something simple, but I can't seem to figure it out. Why doesn't this code work?
DECLARE @FirstSaturday DATETIME
DECLARE @ENDDATE DATETIME
SELECT @FirstSaturday = min(RED1.DATE)
FROM REDFRIDAYDATES..TBLREDFRIDAYALLDATES RED1
WHERE Period = 9 AND year = 2009
SELECT CASE
WHEN getdate() < @FirstSaturday
THEN set @ENDDATE = getdate()
ELSE SET @enddate = @FirstSaturday
END
I simply want the value of the earlier date, today or the end of the period, to be assigned to @enddate.
Can someone point me in the right direction? I am using SQL 2000.