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

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -