declare @ll int select @ll=count(*) from table if @ll>0 then select "有记录" end if
if exists(select * from table)
use CY go if exists(select name from sysobjects where name= 'lpy' and type='p') ********** drop procedure lpy go create procedure lpy @money int as select * from Cgongzi where 底薪>=@money order by 底薪 desc go 一个最简单的存储过程 ******** 是你想要的部分
begin
end
select @ll=count(*) from table
if @ll>0 then
select "有记录"
end if
go
if exists(select name from sysobjects where name= 'lpy' and type='p') **********
drop procedure lpy
go
create procedure lpy
@money int
as
select * from Cgongzi where 底薪>=@money
order by 底薪 desc
go 一个最简单的存储过程 ******** 是你想要的部分
返回受上一语句影响的行数
但是用exists的问题少,昨天刚解决了一个用@@rowcount出错的问题,解决方法就是改用EXISTS