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

求一个求数据库中表的数据行数的sql?急,没分了
use pubs

select name from sysobjects where type='U'

得到数据
titleauthor
stores
sales
roysched
discounts
jobs
pub_info
employee
authors
publishers
titles

我想得到它们的实际数据条数



titleauthor 35
stores 40
sales 88
roysched
discounts
jobs
pub_info
employee
authors
publishers
titles


------解决方案--------------------
SQL code

SELECT 
    a.name AS 表名,
    b.rows  AS AS 记录数
from sysobjects  AS a
    INNER JOIN sysindexes AS b ON a.ID=b.id AND b.indid<2
where a.type='U''