三层:按条件查询

来源:互联网 发布:剑灵男人族捏脸数据 编辑:程序博客网 时间:2024/05/12 18:32

create proc p_book_select
@bTitle varchar(10)='',
@uName varchar(10)='',
@bStatus int= 0,
@bTId int=0
as
begin
select * from book where
(bTitle like '%'+@bTitle+'%' or @bTitle='') and
(uName=@uName or @uName='') and
(bStatus=@bStatus or @bStatus=0) and
(bTId=@bTId or @bTId=0)
end