日期:2014-05-18  浏览次数:20417 次

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

------解决方案--------------------
select @@rowcount
------解决方案--------------------
在语句后+
select * from ta
print @@rowcount
------解决方案--------------------
select count(*) from
(
查询语句
)
------解决方案--------------------
select rowcnt from sysindexes where
id in (select id from sysobjects where name = 'tablename ')
and status=0

最快的方法!
------解决方案--------------------
@@rowcount
------解决方案--------------------
@@ROWCOUNT
返回受上一语句影响的行数。

语法
@@ROWCOUNT

返回类型
integer

注释
任何不返回行的语句将这一变量设置为 0 ,如 IF 语句。


------解决方案--------------------
select count(*) from tbName
where ...