how to count the number of tables in a database

  • hi all

    i want to know how to count the number of tables in a database. if it is possible through any command or other . tell me pls

    thanks

    aswin..

  • Select count(*) from sys.tables

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • select count(TABLE_NAME)

    from INFORMATION_SCHEMA.Tables

    Will return all tables and views.

    To just return count of tables (no views), use:

    select count(TABLE_NAME)

    from INFORMATION_SCHEMA.Tables

    where Table_Type = 'Base Table'

  • thanks

    aswin..

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply