Introduction: In this
article I am going to share how to get/find/check all the constraints defined
on sql server table.
In previous article i explained How to Create and Drop Foreign Key Constraint in sql server table and Take automatic backup of Sql server Database and Convert SQL Server 2012,2008 database to SQL Server 2005 or lower version and Backup and restore sql server database
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'
EXEC sp_helpconstraint 'tbEmployee'
Above command will show you all
the constraints defined on table
Second command:
For example:
Note:
tbEmployee is the name of the table whose constraints we want to check
" 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."
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.
Now over to you:
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..