传统做法可能是select count(1)
但是往往会比较慢。推荐如下做法:
SELECT ISNULL(MAX(rowcnt), 0) CurrentRowCount
FROM sys.sysindexes WHERE id = OBJECT_ID('TableName')