SYNTAX HELP please ..

  • Team:

    I am almost there.... Help get the fourth column

    The query gives the names of the tables that have foreign keys, name of the field that holds the foreign key, which table it references and then

    I need the help to find which colun is it pointing at ... You know what I mean 🙂

    😀

    Select object_name(fk.parent_object_Id) this_table_has_it, c.name this_is_the_column,

    object_name(fk.referenced_object_Id) as references_this_table

    FROM sys.foreign_keys fk

    inner join sysconstraints o

    on fk.object_id = o.constid

    inner join sys.columns c on ( ( c.object_id = o.id) and (c.column_id = o.colid) ):-D

  • Please see your other post, I posted an updated query

    http://www.sqlservercentral.com/Forums/Topic1729985-2799-1.aspx

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

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