Last active
          November 23, 2016 09:38 
        
      - 
      
 - 
        
Save saurabhj/be26b612f4d95981ab0bd44e15858b76 to your computer and use it in GitHub Desktop.  
    Tables and their Rows in MS-SQL
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | -- Returns a list of all User created tables on MS-SQL along with a count of rows of each | |
| SELECT o.NAME, | |
| i.rowcnt | |
| FROM sysindexes AS i | |
| INNER JOIN sysobjects AS o ON i.id = o.id | |
| WHERE i.indid < 2 AND OBJECTPROPERTY(o.id, 'IsMSShipped') = 0 | |
| ORDER BY o.NAME | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment