jeudi 4 juin 2015

dateadd() is not working as desired to find the date of 7 days from now sql-server

I am trying to find the date of 7 days from a specific date. To do this I tried

Select @Fromdate = DATEADD(day,-7, max(last_update)), @todate= max(last_update)
FROM vwABC

But it is not working and when I tried the following every thing works fine.

SELECT @Fromdate = '20150601', @ToDate = MAX(last_update)
FROM vwABC

I cant understand, whats the problem. Please help.

Aucun commentaire:

Enregistrer un commentaire