Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Posts
    4

    Angry Unanswered: Finding field in entire DB

    I need to write a SQL statement that will check an entire DB for all tables that have <SomeField> as part of the table. Example...
    <Field X> is part of <Table A>, <Table C>, <Table F>, etc...

    Thanks in advance

  2. #2
    Join Date
    Aug 2002
    Location
    Madrid, Spain
    Posts
    97
    I presume you're looking for tables and views having
    a certain column. All columns used by tables and
    views (and even stored procedures' parameters)
    are stored in syscolumns, in each database. If
    you don't need to identify the table owner, just
    code

    select object_name(id) from syscolumns
    where name='MYCOLUMN_NAME'

    Regards,
    Mariano Corral

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •