sp_helpconstraint (T-SQL)

Returns a list of all constraint types, their user-defined or system-supplied name, the columns on which they have been defined, and the expression that defines the constraint (for DEFAULT and CHECK constraints only).

Syntax

sp_helpconstraint [@objname =] 'table'
    [,[@nomsg =] 'no_message']

Arguments
[@objname =] 'table'
Is the table about which constraint information is returned. The table specified must be local to the current database. table is nvarchar(776), with no default.
[@nomsg =] 'no_message'
Is an optional parameter that prints the table name. no_message is varchar(5), with a default of msg. nomsg suppresses the printing.
Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Remarks

Executing sp_help table reports all information about the specified table. To see only the constraint information, use sp_helpconstraint.

Permissions

Execute permissions default to the public role.

Examples

This example shows all constraints for the authors table.

USE pubs

EXEC sp_helpconstraint authors

  

See Also
ALTER TABLE sp_help
CREATE TABLE System Stored Procedures

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.