SQL - Subtract Date with Integer -
i have document has "delivery date" , "days deliver" fields calculate "dispatch date" = "delivery date" subtract "days deliver"
currently i'm trying:
dbo.t0.docduedate-dbo.crd1.daystodeliver
am getting datetime format error above. getting wrong?
assuming using sql server, use sql function dateadd()
.
first parameter d
stands day.
second parameter how many days want add , putting minus (-)
in front instead of adding subtracts value.
last parameter initial date want manipulated.
might need cast input values appropriate types - second parameter has integer.
select dateadd(d,-[daystodeliver], [deliverydate]) 'dispatch date' [table]
Comments
Post a Comment