1、  对update,delete也有效
...
select @@rowcount as 行数
2、  只能select语句
select count(*) as 行数 from (
...
) as t

解决方案 »

  1.   

    @@rowcount好像取不到吧!
    select count(*) as '行数' from tbladmin
    结果:
    行数          
    ----------- 
              2 
    raiserror('%d',16,1,@@rowcount)
    结果:
    1
      

  2.   

    谢谢楼上两位兄弟的回复!
    有没有类似select count(select * from aa)这样的语句可以进行统计??
      

  3.   

    select count(select * from a)
    select count(select f1,f2 from bb where f1='ff')
      

  4.   

    select count(*) from (你的select语句) a
      

  5.   

    SELECT @@rowcount AS 行数
      

  6.   

    非常感谢zjmym(缘木)的回答,
    select count(*) from (你的select语句) a
    最后的a是什么意思?为什么我替换为任意的串都可以??
    另:select count(select * from a)
      select count(select f1,f2 from bb where f1='ff')
    都无法通过编译。
      

  7.   

    select count(*) from (你的select语句) a
    最后的a是 別名