Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    13

    Unanswered: select query to find the particular column in the database

    I have yearmonth column in more than 50 tables in the customers database. I have to find the what are all the tables are having yearmonth column from the customers data base.
    Please provide the select query.Thanks

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    I think this should work:
    Code:
    select  t.table_name
    from    information_schema.COLUMNS c,
            information_schema.TABLES t
    where   c.table_schema = "customers"
            and t.table_schema = "customers"
            and t.table_type = "BASE TABLE"
            and c.table_name = t.table_name
            and c.column_name = "yearmonth";
    Mike

Posting Permissions

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