Search code examples
sybase

how to count number of tables/views/index in my database


how to count number of tables/views/index in my database

I am using sybase 11


Solution

  • select count(*) from sysobjects where type = 'U'
    

    should get you the number of user tables. You can also use type = 'V' to count views.

    select count(*) from sysindexes 
    

    will give you an index count. You may need to further filter both though, depending on which types of indexes you want.

    sysobjects reference here.
    sysindexes reference here.