Retreive a Customized List with input data
My request is to add a parameter that is the name of the constraint and you retrieve a list that shows the name of the table and its column.


use AdventureWorks2012;

declare @ConstraintName varchar(max)

set @ConstraintName = 'CK_Product_ProductLine' --&lt;--- Change  here with your constraint Name

if exists (
        select 1
        from sys.objects
        where OBJECT_NAME(OBJECT_ID) = '' + @ConstraintName + ''
        )
begin
    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 OBJECT_NAME(OBJECT_ID) = '' + @ConstraintName + ''
end
else
    select 'There is no constraint with the name that you specified'


Below will be output :