create procedure sp_test
as 
   select top 10 * from sysobjects
goexec sp_test
--获取存储过程最后返回结果集行数
select @@rowcount
godrop procedure sp_test
go

解决方案 »

  1.   

    select * from 表
    select @@rowcount  --显示前一次查询返回的行数
      

  2.   

    select case when @@rowcount=1 then '一行' 
    when @@rowcount>1 then '多行' else '0行' end as 返回结果
      

  3.   

    存储过程返回一个值!create proc dd(
    @a int output)
    as
    begin
    select * from tb
    set @a=@@rowcount
    enddeclare @b int
    exec dd @b output
    select @b