Follow SQLMaster on Twitter
Welcome to SqlServer-QA.net Sign in | Help

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.

 

Published Tuesday, December 11, 2007 8:23 AM by SQL Master

Comments

# 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

Tuesday, December 11, 2007 8:34 AM by SSQA.net - SqlServer-QA.net

# 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

Tuesday, December 11, 2007 8:49 AM by Other SQL Server Blogs around the Web
Anonymous comments are disabled