How do I find the CHECK constraints that depend on a specified CLR user-defined type?
Here is the another TSQL script from BOL to find the CHECK constraints that depend on a specified CLR user-defined type?
USE <database_name>;
GO
SELECT SCHEMA_NAME(o.schema_id) AS schema_name
,OBJECT_NAME(o.parent_object_id) AS table_name
,OBJECT_NAME(o.object_id) AS constraint_name
FROM sys.sql_dependencies AS d
JOIN sys.objects AS o ON o.object_id = d.object_id
WHERE referenced_major_id = TYPE_ID('<schema_name.data_type_name>')
AND class = 2 -- schema-bound references to type
AND OBJECTPROPERTY(o.object_id, 'IsCheckCnst') = 1; -- exclude non-CHECK dependencies
GO
If you need to know more about CLR user-defined function then refer to CLR-UDF link.
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.