How do I find the CHECK constraints that depend on a specified CLR user-defined type?

Published 11 December 07 08:23 AM | SQL Master 

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.

 

Comments

# SSQA.net - SqlServer-QA.net said on December 11, 2007 8:34 AM:

Here is the another TSQL script from BOL to find the CHECK constraints that depend on a specified CLR

# Other SQL Server Blogs around the Web said on December 11, 2007 8:49 AM:

Here is the another TSQL script from BOL to find the CHECK constraints that depend on a specified CLR

Anonymous comments are disabled

About SQL Master

**__________________________________** 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.

Search

Go

This Blog

«December 2007»
SMTWTFS
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

Syndication