Skip to content

Instantly share code, notes, and snippets.

@mizuneko
Created January 30, 2019 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizuneko/77e4bcd5f10f50bc2d5d43c1d4b680b8 to your computer and use it in GitHub Desktop.
Save mizuneko/77e4bcd5f10f50bc2d5d43c1d4b680b8 to your computer and use it in GitHub Desktop.
[データが存在するテーブルを取得] テーブル名とレコード数を取得 #SQLServer
SELECT [テーブル名] = o.name,
[レコード数] = i.rows
FROM sysindexes i
INNER JOIN
sysobjects o
ON o.id = i.id
WHERE o.xtype = 'U'
AND i.indid < 2
AND i.rows > 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment