@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
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
您可以通过将D
作为第一个参数来使用DATEADD
函数,然后添加要添加的天数和添加日期。
SET @Output=DATEADD(D,@Date,@Rdatetime)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.