1、需要执行语句
declare @c int
select rid from reg where yesno=0
set @c=@@rowcount...select top 10 * from  (select rid from reg where yesno=0) as a
set @c=@@rowcount2、不需要执行语句
declare @c int
select @c=count(*) from reg where yesno=0...select @c=count(*) from  (
select top 10 * from  (select rid from reg where yesno=0) as a
) as t

解决方案 »

  1.   

    "select rid from reg where yesno=0"的影响行数
    和语句
    "select top 10 * from  (select rid from reg where yesno=0) as a" 加個
    print @@rowcount@@rowcount取得行數
      

  2.   

    全局系统变量@@rowcount返回上一个语句执行后所影响的行数.
      

  3.   

    全局系统变量@@rowcount返回上一个语句执行后所影响的行数.
    详细的可以查一下帮助
      

  4.   

    select rid into #1 from reg where yesno=0
    select 影响行数1=select count(*) from #1select top 10 * into #2 from  (select rid from reg where yesno=0) as a
    select 影响行数2=select count(*) from #2drop table #1,#2
      

  5.   

    declare @c int,@d intselect @c=count(rid) from reg where yesno=0
    select top 10 @d=count(*) from  (select rid from reg where yesno=0) as a
     select @c,@d
      

  6.   

    @@ROWCOUNT
    返回受上一语句影响的行数。
    直接打印@@ROWCOUNt