Browse by Tags

List tables that do not have primary keys
02 August 07 04:35 AM | SQL Master | 2 Comments   
SELECT SCHEMA_NAME(schema_id) AS schema_name ,name AS table_name FROM sys.tables WHERE OBJECTPROPERTY(object_id,'TableHasPrimaryKey') = 0 ORDER BY schema_name, table_name; GO About the above function OBJECTPROPERY, BOL refers: This function cannot be Read More...
Filed under: , ,