Check PRIMARY,FOREIGN,UNIQUE KEY CONSTRAINTS in SQL SERVER table

Introduction: In this article I am going to share how to get/find/check all the constraints defined on sql server table.


Description: You can check the primary key constraint, foreign key constraint, unique key constraint or other constraint defined on table using any of the following two easiest commands.

Implementation: Let's check both commands

 First command:

Syntax is: EXEC sp_helpconstraint 'TableName'

For example:

EXEC sp_helpconstraint 'tbEmployee'

Above command will show you all the constraints defined on table

Second command:

Syntax is:  sp_help 'TableName'


For example:

sp_help 'tbEmployee'

Above command will show you all the constraints defined on table at the bottom along with other useful information regarding the table.

Note: tbEmployee is the name of the table whose constraints we want to check 


Now over to you:
" I hope you have got the way to Check PRIMARY,FOREIGN,UNIQUE KEY and other CONSTRAINTS in sql server table and If you like my work; you can appreciate by leaving your comments, hitting Facebook like button, following on Google+, Twitter, Linked in and Pinterest, stumbling my posts on stumble upon and subscribing for receiving free updates directly to your inbox . Stay tuned and stay connected for more technical updates." 
Previous
Next Post »

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..