COLUMN_DOMAIN_USAGE

Information Schema Views Code behind (INFORMATION_SCHEMA.COLUMN_DOMAIN_USAGE)!!!


SELECT  DB_NAME() AS DOMAIN_CATALOG ,
        SCHEMA_NAME(t.schema_id) AS DOMAIN_SCHEMA ,
        t.name AS DOMAIN_NAME ,
        DB_NAME() AS TABLE_CATALOG ,
        SCHEMA_NAME(o.schema_id) AS TABLE_SCHEMA ,
        o.name AS TABLE_NAME ,
        c.name AS COLUMN_NAME
FROM    sys.objects o
        JOIN sys.columns c ON c.object_id = o.object_id
        JOIN sys.types t ON t.user_type_id = c.user_type_id
WHERE   c.user_type_id > 256

Advertisements
This entry was posted in Database Administration, Information Schema. Bookmark the permalink.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s