SQL Server Performance

Tables with no Primary and Foreign keys

Discussion in 'Other SQL Server Blogs around the Web' started by Anonymous, Apr 10, 2009.

  1. Anonymous New Member

    John Paul Cook has posted in his blog to show the list of tables that have no Referential Integrity. What if you want to know list of tables that have no primary and foreign keys? Here is the query select table_name from INFORMATION_SCHEMA.TABLES where objectproperty ( object_id ( table_name ), 'TableHasForeignKey' )= 0 AND objectproperty ( object_id ( table_name ), 'TableHasPrimaryKey' )= 0 AND table_type = 'BASE TABLE' order by table_name...(<a href="http://sqlserver-qa.net/blogs/t-sql/archive/2009/04/10/5582.aspx">read more</a>)<img src="http://sqlserver-qa.net/aggbug.aspx?PostID=5582" width="1" height="1">

Share This Page