Created
September 21, 2015 09:21
-
-
Save DylanKnevitt/c88b532f32b810a4a708 to your computer and use it in GitHub Desktop.
Find all tables that do not have any Primary Keys
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 * FROM sys.tables st | |
LEFT JOIN sys.key_constraints kc on kc.parent_object_id = st.object_id and kc.type = 'PK' | |
WHERE kc.name is null | |
order by st.name asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment