title: How to get the row count for views from a database?
body: <p>I'm trying to make a customized view that gets me the row count for all the views and tables of a database.</p>
  
  <p>Getting the count of table is damn in SQL Server</p>
  
  <pre><code>SELECT TABLE_SCHEMA,
         TABLE_NAME = TABLES.TABLE_NAME,
         RECORD_COUNT = MAX(SYSINDEXES.ROWS)
  FROM   SYS.SYSINDEXES "SYSINDEXES",
         INFORMATION_SCHEMA.TABLES "TABLES"
  WHERE  TABLES.TABLE_NAME = OBJECT_NAME(SYSINDEXES.ID)
         AND TABLES.TABLE_TYPE = 'BASE TABLE'
  GROUP  BY TABLES.TABLE_SCHEMA,
            TABLES.TABLE_NAME  
  </code></pre>
  
  <p>Now, I need to get the rowcount for VIEWS</p>
  
  <p>I feel the only way is to count the number of rows from the views
  i.e. <code>count(*) from view_name</code></p>
  
  <p>But, I could not find a way to have the rowcount for view along with view_name, table_schema and so on.</p>
  
  <p>Any advance on this would be helpful.</p>