6 个解决方案
#1
--这个row数量不会太实时。想精确,就得循环SELECT COUNT(*) FROM TABLENAME的方式。没效率
SELECT
A.NAME,
MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B
ON A.object_id = B.object_id
GROUP BY A.name
ORDER BY MAX(B.rows) DESC
#2
select distinct object_name(id) from sys.sysindexes where rowcount>1
#3
是rowcount>0
#4
靠,老写错,rowcnt>0
#5
应该是
select distinct object_name(id) from sys.sysindexes where rows>0
#6
SELECT
A.NAME,
MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B
ON A.object_id = B.object_id
WHERE B.rows > 0
GROUP BY A.name
ORDER BY MAX(B.rows) DESC
#1
--这个row数量不会太实时。想精确,就得循环SELECT COUNT(*) FROM TABLENAME的方式。没效率
SELECT
A.NAME,
MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B
ON A.object_id = B.object_id
GROUP BY A.name
ORDER BY MAX(B.rows) DESC
#2
select distinct object_name(id) from sys.sysindexes where rowcount>1
#3
是rowcount>0
#4
靠,老写错,rowcnt>0
#5
应该是
select distinct object_name(id) from sys.sysindexes where rows>0
#6
SELECT
A.NAME,
MaxRows = MAX(B.rows)
FROM sys.tables A
INNER JOIN sys.partitions B
ON A.object_id = B.object_id
WHERE B.rows > 0
GROUP BY A.name
ORDER BY MAX(B.rows) DESC