Created
July 16, 2016 17:14
-
-
Save jeremykdev/bd54d9a5e3803b6c785210a23d7254b0 to your computer and use it in GitHub Desktop.
Find Microsoft SQL Server database tables without an identity column
This file contains 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
SELECT | |
S.name AS SchemaName | |
,T.name AS TableName | |
FROM sys.tables AS T | |
INNER JOIN sys.schemas AS S ON ( T.schema_id = S.schema_id ) | |
WHERE NOT EXISTS ( | |
SELECT * | |
FROM sys.columns AS C | |
WHERE C.object_id = T.object_id | |
AND C.is_identity = 1 | |
) | |
ORDER BY S.name, T.name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment