I'm trying to get yesterdays date on 18:00:00 time.
I've tried this:
DECLARE @YesturdayDate datetime = DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()-1));
select dateadd(h,18,@YesturdayDate)
but i'm getting an error when run the select statement:
"Must declare the scalar variable "@YesturdayDate". "
why is that?
thanks.