SQL Server: Script to find all the Tables without having a Primary Key

In this post, I am providing a script to find all the tables without having a Primary Key in a database of SQL Server.

This script is very important because Primary Key is a one of a major part of the table. I never recommended to create a table without Primary Key and even at this stage not require to explain the importance of Primary Key.

You can visit this article for more details:

Best practice for Primary Key in Database Management System

Using this script, I have found all the tables that do not have a primary key and which are created by another database development team So for me this is time to add missing Primary Keys.

Below is a two different script to find missing Primary Keys:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

Be the First to Comment!

Notify of