如何SQL返回查询的记录数?

解决方案 »

  1.   

    在语句后+
    select * from ta
    print @@rowcount
      

  2.   

    select count(*) from
    (
      查询语句
    )
      

  3.   

    select rowcnt from sysindexes where 
    id in (select id from sysobjects where name ='tablename')
    and status=0最快的方法!
      

  4.   

    @@ROWCOUNT
    返回受上一语句影响的行数。语法
    @@ROWCOUNT返回类型
    integer注释
    任何不返回行的语句将这一变量设置为 0 ,如 IF 语句。
      

  5.   

    select count(*) from tbName
    where ...