--페이징 프로시저
create proc pagen_num(@ct_text nvarchar(20),@text nvarchar(50),@page_num int)
--@page_num int
as
begin
if(@ct_text is null or @ct_text = '')
begin
select ceiling(cast(count(*) as float)/@page_num)
from dbo.Cafe
end
else if(@ct_text = 'All')-- 카테고리랑 상관없이 카페명으로만 검색
begin
select ceiling(cast(count(*) as float)/@page_num)
from dbo.Cafe
where name like '%' + @text + '%'
end
else--카테고리와 카페명으로 검색
begin
select ceiling(cast(count(*) as float)/@page_num)
from dbo.Cafe cf inner join dbo.Category cg
on cf.fk_cate = cg.cate_id
where name like '%' + @text + '%' and cate_name = @ct_text
end
end
댓글 영역