SQL Server Performance

SQL Query

Discussion in 'SQL Server 2005 General DBA Questions' started by Joben, Jan 7, 2011.

  1. Joben New Member

    Does any body know the script to list all the tables. I would appreciate your help.
    Thank you
  2. Luis Martin Moderator

    Home work?
  3. preethi Member

    sp_SpaceUsed is used to get the space used by the table
    select Count(*) from table will return the number of rows in a table, but it is resource consuming. I generally use
    select rows from sysindexes where id = object_Id('table') and indid <2
    but it may not be accurate all the time. If you need it for all tables, you can try this.
    select object_name(id), rows from sysindexes where indid<2
    Hope this helps.
  4. Madhivanan Moderator

    EXEC sp_tables

Share This Page