日期:2014-05-18 浏览次数:20539 次
ALTER PROCEDURE [dbo].[output_jkzx] @s_db nvarchar(100), @d_db nvarchar(100), @exec_time int AS declare @paramtdatetime datetime=(select getdate()) declare @csd_batdeg nvarchar(2000) BEGIN set @csd_batdeg='insert jkzx.'+@d_db+'.dbo.csd_batdeg'+' select * from '+@s_db+'.dbo.csd_batdeg where tm_datetime between dateadd(hour,'+convert(varchar(10),-@exec_time-24)+','+@paramtdatetime+') and dateadd(hour,'+convert(varchar(10),-@exec_time)+','+@paramtdatetime+')' exec sp_executesql @csd_batdeg,@s_db,@d_db,@exec_time
ALTER PROCEDURE [dbo].[output_jkzx] @s_db nvarchar(100), @d_db nvarchar(100), @exec_time int AS declare @paramtdatetime datetime set @paramtdatetime=getdate() declare @csd_batdeg nvarchar(2000) set @csd_batdeg='insert jkzx.'+@d_db+'.dbo.csd_batdeg'+ ' select * from '+@s_db+ '.dbo.csd_batdeg where tm_datetime between dateadd(hour,'+ convert(varchar(10),-@exec_time-24)+',' +convert(varchar(10),@paramtdatetime,120) +') and dateadd(hour,'+convert(varchar(10),-@exec_time)+ ','+convert(varchar(10),@paramtdatetime,120)+')' exec sp_executesql @csd_batdeg,@s_db,@d_db,@exec_time