sql 返回值的问题。

来源:百度知道 编辑:UC知道 时间:2024/06/25 16:32:20
高手帮忙看一下,怎么返回值一直都是 0
CREATE PROCEDURE pr_Select
@TxtKey varchar(20),
@SelectName varchar(20)
as
begin

if @TxtKey = '姓名'
begin
select count(*) from tb_Information where UserName like '%@SelectName%'
end

else if @TxtKey = '所学专业'
begin
select count(*) from tb_Information where Subject like '%@SelectName%'
end

else if @TxtKey = '学历'
begin
select count(*) from tb_Information where Xueli like '%@SelectName%'
end

else if @TxtKey = '职称'
begin
select count(*) from tb_Information where Zhicheng like '%@SelectName%'
end

else if @TxtKey = '科室'
begin
select count(*) from tb_Information where Keshi like '%@SelectName%'
end

else
begin
select count(*) from tb_Information
end

return @@ROWCOUNT

end
GO

CREATE PROCEDURE pr_Select
@TxtKey varchar(20),
@SelectName varchar(20)
as
begin

if @TxtKey = '姓名'
begin
select count(*) from tb_Information where UserName like '%'+@SelectName+'%'
end

else if @TxtKey = '所学专业'
begin
select count(*) from tb_Information where Subject like '%'+@SelectName+'%'
end

else if @TxtKey = '学历'
begin
select count(*) from tb_Information where Xueli like '%'+@SelectName+'%'
end

else if @TxtKey = '职称'
begin
select count(*) from tb_Information where Zhicheng like '%'+@SelectName+'%'
end

else if @TxtKey = '科室'
begin
select count(*) from tb_Information where Keshi like '%'+@SelectName+'%'
end

else
begin
select count(*) from tb_Information
end

return @@ROWCOUNT