27,579
社区成员
发帖
与我相关
我的任务
分享
--测试数据
if not object_id(N'Tempdb..#T') is null
drop table #T
Go
Create table #T([期限] int,[时间] Date)
Insert #T
select 24,'2017-04-13' union all
select 12,'2017-04-14'
Go
--测试数据结束
Select dateadd(month,期限,时间) from #T
-- 你那里什么提示信息
declare @n int
set @n = 10
select DATEADD(month,@n,getdate()) result
go
create table test(n int)
go
insert into test values(1),(2),(3),(4)
go
select dateadd(month,n,getdate()) result from test
go
drop table test
go
result
-----------------------
2018-03-03 17:27:03.533
(1 行受影响)
(4 行受影响)
result
-----------------------
2017-06-03 17:27:03.550
2017-07-03 17:27:03.550
2017-08-03 17:27:03.550
2017-09-03 17:27:03.550
(4 行受影响)