34,589
社区成员
发帖
与我相关
我的任务
分享
use kft_log
go
if OBJECT_ID('getmylog') is not null
drop procedure getmylog
go
create procedure getmylog(@billno varchar(20),@month varchar(5))
as
begin
declare @name varchar(50)
set @name='dbo.KFT_DebugLog2_'+convert(varchar(4),GETDATE(),120)+@month
/*
set @name='dbo.KFT_DebugLog2_'+convert(varchar(4),GETDATE(),120)+cast(DATEPART(MM,GETDATE()) as varchar(10))
自动获取当前月份作为查询表名
*/
exec('select * from '+ @name+' where parameters like '%@billno%' order by createdate')
end
use kft_log
go
if OBJECT_ID('getmylog') is not null
drop procedure getmylog
go
create procedure getmylog(@billno varchar(20),@month varchar(5))
as
begin
declare @name varchar(50)
set @name='dbo.KFT_DebugLog2_'+convert(varchar(4),GETDATE(),120)+@month
/*
set @name='dbo.KFT_DebugLog2_'+convert(varchar(4),GETDATE(),120)+cast(DATEPART(MM,GETDATE()) as varchar(10))
自动获取当前月份作为查询表名
*/
exec('select * from '+ @name+' where parameters like ''%'+@billno+'%'' order by createdate')
end