SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
EXCEPT
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'
Thursday, December 17, 2009
Determine Tables w/o a PK
How to determine which tables in a database do not have a primary key. Needed this for a replication rollout.
Subscribe to:
Posts (Atom)