开发者

Add 1 day to original date and put in a different table

How do I add one day from Created_Date and pu开发者_开发知识库t into Due_Date field?

It is the smalldatetime data type if that makes a difference


Use the DateAdd() function.

UPDATE someTable SET Due_Date = DATEADD(day,1,Created_Date) WHERE ...


Actually, with respect to DAY, you can just add/subtract directly. I.e. (borrowing from @David):

UPDATE someTable SET Due_Date = Due_Date + 1 WHERE ...

It's just a short-cut for DATEADD().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜