DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: A Sql Question

  1. #1
    Join Date
    Aug 2003
    Location
    china
    Posts
    26

    A Sql Question

    How to find all the tables containing column ,say 'COL1',in a schema?
    Is there a dictionay view containing all columns info?

    Thanks

  2. #2
    Join Date
    Feb 2001
    Location
    Adelaide, Australia
    Posts
    159
    Try:

    select table_name
    from dba_tab_columns
    where column_name='COL1';

    Good luck!

  3. #3
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Code:
    Select 
      Distinct Table_Name
    From
      DBA_TAB_COLUMNS
    Where
      OWNER       = 'Schema_Name' AND
      Column_Name = 'COL1'
    ;

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  4. #4
    Join Date
    Jul 2003
    Location
    Sofia, Bulgaria
    Posts
    91
    Originally posted by abhaysk
    Code:
    Select 
      Distinct Table_Name
    From
      DBA_TAB_COLUMNS
    Where
      OWNER       = 'Schema_Name' AND
      Column_Name = 'COL1'
    ;

    Abhay.
    abhaysk why distinct?

  5. #5
    Join Date
    Jun 2003
    Posts
    108
    try this, u can get all info.

    desc dba_tab_columns

  6. #6
    Join Date
    Aug 2003
    Location
    china
    Posts
    26
    That's what I want.
    Thank you all so much

  7. #7
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Originally posted by stancho
    abhaysk why distinct?
    I think, i need break or a cup of coffee will do
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  8. #8
    Join Date
    Aug 2003
    Location
    china
    Posts
    26
    with sql:
    select table_name
    from dba_tab_columns
    where column_name='COL1';

    I get all tables and VIEWS that containing column 'COL1', if I only want the tables , not including views, what should i do?

  9. #9
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Join with DBA_OBJECTS to elminate
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

Posting Permissions

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


Click Here to Expand Forum to Full Width