TABLES

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

    SELECT  DB_NAME() AS TABLE_CATALOG ,
            s.name AS TABLE_SCHEMA ,
            o.name AS TABLE_NAME ,
            CASE o.type
              WHEN 'U' THEN 'BASE TABLE'
              WHEN 'V' THEN 'VIEW'
            END AS TABLE_TYPE
    FROM    sys.objects o
            LEFT JOIN sys.schemas s ON s.schema_id = o.schema_id
    WHERE   o.type IN ( 'U', 'V' )
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