【SQL开源代码栏目提醒】:网学会员鉴于大家对SQL开源代码十分关注,论文会员在此为大家搜集整理了“imi_search.sql”一文,供大家参考学习
use produce
go
if object_id('dbo.imi_Search') is not null
drop procedure dbo.imi_search
go
create procedure imi_search
@action_cd char(2)=null,
@vendor varchar(30)=null,
@customer varchar(30)=null,
@type char(10)=null,
@ckyear int=null,
@ckmonth int=null,
@ckday int=null,
@status char(2)=null
as
if(@action_cd='AA')
begin
select * from iqc_imi order by item
return
end
if(@action_cd='AT')
begin
select * from iqc_imi where type=@type order by item
return
end
if(@action_cd='AD')
begin
select * from iqc_imi where ckday=@ckday order by item
return
end
if(@action_cd='AM')
begin
select * from iqc_imi where ckmonth=@ckmonth order by item
return
end
if(@action_cd='AY')
begin
select * from iqc_imi where ckyear=@ckyear order by item
return
end
if(@action_cd='AS')
begin
select * from iqc_imi where status=@status order by item
return
end
if(@action_cd='A1')
begin
select * from iqc_imi where type=@type and ckday=@ckday order by item
return
end
if(@action_cd='A2')
begin
select * from iqc_imoi where type=@type and ckmonth=@ckmonth order by item
return
end
if(@action_cd='A3')
begin
select * from iqc_imi where type=@type and ckyear=@ckyear order by item
return
end
if(@action_cd='A4')
begin
select * from iqc_imi where type=@type and ckday=@ckday order by item
return
end