开发者

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

开发者 https://www.devze.com 2023-03-23 20:32 出处:网络
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 differenceUse the DateAdd() function.

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

精彩评论

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