将日期添加到日期并在SQL SERVER 2012的表中插入添加日期(Add days to a date and insert added date in table for SQL SERVER

编程入门 行业动态 更新时间:2024-10-24 22:27:09
日期添加到日期并在SQL SERVER 2012的表中插入添加日期(Add days to a date and insert added date in table for SQL SERVER 2012)

@Rdatetime ='2017-04-18 11:49:38.633'

@日期添加= 2

@Output ='2017-04-20 11:49:38.633'

大家好,这是我的问题,我得到Rdatetime和日期被添加到另一个表中。 我有哟添加日期并以日期时间格式保存

提前致谢

@Rdatetime ='2017-04-18 11:49:38.633'

@Date to add = 2

@Output = '2017-04-20 11:49:38.633'

Hi all, This is my Problem , i am getting Rdatetime and date to be added in another table . i have yo add the date and save it in datetime format

thanks in advance

最满意答案

使用DATEADD内置函数:

DECLARE @Rdatetime DATETIME ='2017-04-18 11:49:38.633' DECLARE @Date INT = 2 DECLARE @Output DATETIME = DATEADD(DAY,@Date,@Rdatetime) SELECT @Output

Use DATEADD built in function :

DECLARE @Rdatetime DATETIME ='2017-04-18 11:49:38.633' DECLARE @Date INT = 2 DECLARE @Output DATETIME = DATEADD(DAY,@Date,@Rdatetime) SELECT @Output

更多推荐

本文发布于:2023-08-07 06:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463144.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   并在   SERVER   Add   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!