sql 存储过程带有模糊查询条件
时间:2021-07-01 10:21:17
帮助过:2人阅读
int,
@endRecordIndex int,
@seach nvarchar(10),
@docount bit)
as
set nocount on
if(@docount=
1)
--只需要把%
与搜索的字符串用拼接的方式即可
select count(*)
from Job
where name like
‘%@seach%‘ or work_address like
‘%@seach%‘
else
begin
declare @indextable table(id int identity(
1,
1),nid
int)
set rowcount @endRecordIndex
insert into @indextable(nid) select ID
from Job
where name like
‘%@seach%‘ or work_address like
‘%@seach%‘ order by CreateTime desc
select *
from Job O,@indextable t
where O.ID=
t.nid
and t.id between @startRecordIndex and @endRecordIndex order by t.id
end
set nocount off
sql 存储过程带有模糊查询条件
标签:into like ddr esc count begin res varchar doc