Some time it is required find some constraints which has been applied on the particular table. For example, primary key constraint, foreign key constraint, unique key constraint or other constraint.
This can
be done by using query in SQL server database. We use in built procedure to
find out details about table. We pass
table name as parameter.
You can check the primary key constraint,
foreign key constraint, unique
key constraint or other constraint defined on table using following ways:
First command:
Syntax
is: EXEC sp_helpconstraint 'TableName'
For
example:
EXEC sp_helpconstraint 'Emp_table'
Above
command will show you all the constraints applied on table
Second command:
Syntax
is: sp_help 'TableName'
For
example:
sp_help 'Emp_table'
It will
show you all the constraints applied on table along with other useful
information.
0 comments:
Post a Comment