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


i trying find date of 7 days specific date. tried

select @fromdate = dateadd(day,-7, max(last_update)), @todate= max(last_update) vwabc 

but not working , when tried following every thing works fine.

select @fromdate = '20150601', @todate = max(last_update) vwabc 

i cant understand, whats problem. please help.

this worked me through reference stackoverflow question

select @fromdate = convert(date, dateadd(day,-7, max(last_update)),101),  @todate= max(last_update) vwabc 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -