Find all tables without Primary Keys
This is very simple but effective script. It list all the table without primary keys.
This is very simple but effective script. It list all the table without primary keys.
SELECT SCHEMA_NAME(schema_id) AS SchemaName,name AS TableNameFROM sys.tablesWHERE OBJECTPROPERTY(OBJECT_ID,'TableHasPrimaryKey') = 0ORDER BY SchemaName, TableName;GO
Thats all. Happy Querying :).