Skip to content

Instantly share code, notes, and snippets.

@saurabhj
Last active November 23, 2016 09:38
Show Gist options
  • Select an option

  • Save saurabhj/be26b612f4d95981ab0bd44e15858b76 to your computer and use it in GitHub Desktop.

Select an option

Save saurabhj/be26b612f4d95981ab0bd44e15858b76 to your computer and use it in GitHub Desktop.

Revisions

  1. saurabhj renamed this gist Nov 23, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. saurabhj created this gist Nov 23, 2016.
    8 changes: 8 additions & 0 deletions TableAndRows
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    -- 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