Date calculation conversion issues
I'm trying to calculate a the date difference of date - day
开发者_开发百科where the result is date format.
Update PermanentArrears set duedate = Cast(convert(char(8),Datediff(Day, [arrearsdays], [WorkingDate])) As Date)
At some point I got the right result but I do not anymore. Here is the error message I receive:
Conversion failed when converting date and/or time from character string.
You want to be using dateadd
instead of datediff
EDIT: you don't need to convert - dateadd
returns the same date format that is passed in
Update PermanentArrears
set duedate = Dateadd(Day, [arrearsdays], [WorkingDate])
精彩评论