SEarching for Columns

  • Hi All,

    Is there a a big difference between the two below queries if all you looking for is the a Table and Column Name:

    SELECT [T].[TABLE_NAME],[COLUMN_NAME]

    FROM INFORMATION_SCHEMA.COLUMNS [C]

    INNER JOIN INFORMATION_SCHEMA.TABLES [T]

    ON [C].[TABLE_NAME] = [T].[TABLE_NAME]

    WHERE TABLE_TYPE = 'base table'

    vs

    SELECT o.Name,C.Name

    FROM sysColumns [C]

    INNER JOIN sysObjects [o]

    ON [o].ID = [C].ID

    WHERE [o].xType = 'U'

    thanks

    Chris

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • Hi again,

    I think I might have worked this out.

    The Scan count and Logical Reads are far great when using the INFORMATION_SCHEMA as apposed to the sys tables.

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply