October 5, 2017 at 12:44 pm
Want to see all constraints in at single or multiple table .We tried below query where i was able to get all Constraint -
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'
but when we want to see data for single or tow or three not able to get the data .please correct the below query ...
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT' and name ='anyTablename '
October 5, 2017 at 4:02 pm
mytesting9 - Thursday, October 5, 2017 12:44 PMWant to see all constraints in at single or multiple table .We tried below query where i was able to get all Constraint -SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT'but when we want to see data for single or tow or three not able to get the data .please correct the below query ...
SELECT OBJECT_NAME(OBJECT_ID) AS NameofConstraint,
SCHEMA_NAME(schema_id) AS SchemaName,
OBJECT_NAME(parent_object_id) AS TableName,
type_desc AS ConstraintType
FROM sys.objects
WHERE type_desc LIKE '%CONSTRAINT' and name ='anyTablename '
WHERE type_desc LIKE '%CONSTRAINT' and OBJECT_NAME(parent_object_id) ='TableName'
Sue
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply