Home Forums SQL Server 7,2000 Working with Oracle Query to get related Table name from given Column name in Oracle SQL Developer RE: Query to get related Table name from given Column name in Oracle SQL Developer

  • Sean Lange (7/9/2013)


    ummm....tables do not reside inside of a user or a role. They exist in the database, access to those tables is handled by the permissions granted to users and/or roles.

    Do you get an error when you run this?

    SELECT COLUMN_NAME, TABLE_NAME

    FROM INFORMATION_SCHEMA.COLUMNS

    i think he's very oracle oriented.

    I tend to use the Oracle or SQL related views, instead of the information_schema stuff;

    so for example, in oracle, i'd query user_tab_cols; in SQL, i'd query sys.columns directly

    --ORACLE

    select * from user_tab_cols where column_name='ACTTBLKEY';

    --SQL-

    SELECT OBJECT_NAME(object_id) As TABLE_NAME,* from sys.columns WHERE name = 'ACTTBLKEY';

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!