sql作业问题如何把时间往前调3个月
declare @mm as varchar(6)
set @mm = convert(varchar(6), datename(yy,getdate()) +
datename(mm,getdate()) ,112)
declare @tb as varchar(50)
set @tb = 'sexit' + @mm+'1060003'
exec('drop table ' + @tb)
这个可以删掉本月生成的表,如何设置使其改为删掉3个月前生成的那张表
[解决办法]
dateadd(mm,-3,getdate())
[解决办法]
dateadd(m,-3,getdate())
[解决办法]
哎,能力有限,帮不了你了,坐等大牛!
[解决办法]
declare @mm as varchar(6)
set @mm = convert(varchar(6),dateadd(month,-3,getdate()),112)
declare @tb as varchar(50)
set @tb = 'sexit' + @mm+'1060003'
exec('drop table ' + @tb)
[解决办法]
declare @mm as varchar(6)set @mm = convert(varchar(6),dateadd(month,-3,getdate()),112)declare @tb as varchar(50)set @tb = 'sexit' + @mm+'1060003'exec('drop table ' + @tb)