SQL count rows in a table

前端 未结 6 1350
迷失自我
迷失自我 2020-12-15 15:28

I need to send a SQL query to a database that tells me how many rows there are in a table. I could get all the rows in the table with a SELECT and then count them, but I don

6条回答
  •  [愿得一人]
    2020-12-15 15:55

    Why don't you just right click on the table and then properties -> Storage and it would tell you the row count. You can use the below for row count in a view

    SELECT SUM (row_count) 
    FROM sys.dm_db_partition_stats 
    WHERE object_id=OBJECT_ID('Transactions')    
    AND (index_id=0 or index_id=1)`
    

提交回复
热议问题