Query DB for tables with records

  • I need to query my DB for tables in the DB that have > 100 records in them and also egt a record count from each table that meets the above requirement.

     

    Thanks,

     

    Chris

  • Select O.Name, MAX(I.rowcnt) AS rowcnt from dbo.SysObjects O inner join dbo.SysIndexes I on O.id = I.id where I.indid = 100 order by O.name

    Please note that this is an approximate row count. If you need the actual exact rowcount, you must select from each table one at the time.

  • That worked great! If I wanted to sort these records by a field called dataareaid, how would I do that?

     

    does this require a compound select statement? because if i type in my first select statement for dataareaid, then it runs both queries but seperates them in the pane. So basically I have narrowed down the tables that have more then 100 records, but now I need to sort those records by dataareaid = 'crp'

     

    Thanks

  • Can you show me your current statement and the expected results vs the current results?

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

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