|
I found, much to my surprise (horror), that we've got some tables without primary keys. As it turns out they're lookup tables, so they're pretty static, but still... Now I'm wondering, do we have other tables without primary keys? Is there some DDL query I can run, to list all tables without primary keys?
(comments are locked)
|
|
I think this is what you are looking for. http://sqlserverpedia.com/wiki/Find_Tables_Without_Primary_Keys
(comments are locked)
|
|
Here's an older answer: http://www.mssqltips.com/sqlservertip/1237/finding-primary-keys-and-missing-primary-keys-in-sql-server/ The author shows you a script for 2005, but it worked fine in my 2008 environment. Give it a shot.
(comments are locked)
|

