Counting rows for all tables at once

前端 未结 6 1977
梦毁少年i
梦毁少年i 2020-12-09 10:28

I\'m using SQL Server 2005 and would like to know how I can get a list of all tables with the number of records in each.

I know I can get a list of tables using the

6条回答
  •  -上瘾入骨i
    2020-12-09 11:26

    These all ways will give you the row count in the result set of a select query. SSMS also gives you an option to see the object details via: "Object Explorer Details" pane. This is available for 2005 and all versions after that

    Object Explorer Details is a component of SQL Server Management Studio. It provides a tabular view of all the objects in the server and presents a user interface to manage them.

    To reach "Object Details Window": Click Object you want to see details for in "Object Explorer" pane and press F7. Read More: https://technet.microsoft.com/en-us/library/ms191146(v=sql.90).aspx

    Pros:

    1. Much faster then the select query as SQL Server stores this information
    2. Don't need to write/copy-paste the select query everytime - you are just one F7 away
    3. Gives you much more information and not just about row count

    Note: You might not have Row Count coming in the Object Details pane by default, you can click on the column header and bring it in.

提交回复
热议问题