Some times we want to find out the row counts for all the tables in a particular database in SQL Server. We can do it in different ways. I have tried to give two best ways to find out the row counts in below.
--Get Row Count Of All The Tables In SQL Server Database SELECT object_name(p.object_id) TableName, sum(rows) [RowCount] FROM sys.partitions P JOIN sys.objects O ON P.object_id=o.object_id and type='U' Group by p.object_id Go ---OR----------- SELECT OBJECT_NAME(id) AS TableName, rowcnt AS [RowCount] FROM sysindexes si INNER JOIN sys.tables tab ON si.id = tab.OBJECT_ID AND si.indid IN ( 0, 1, 255 ) WHERE is_ms_shipped = 0Keywords: sql get row count,get row count, number of rows in a table sql,row count in sql, sql count rows in table,how to get count of rows in sql,sql get number of records
0 comments:
Post a Comment