SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Query to get related Table name from given Column name in Oracle SQL Developer


Query to get related Table name from given Column name in Oracle SQL Developer

Author
Message
Guitar_player
Guitar_player
Right there with Babe
Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)

Group: General Forum Members
Points: 763 Visits: 236
Hi ALL,

I am familiar with the SQL server 2008 R2 , but when it comes to the SQL developer i am not that much so i am facing a problem related to the creating Query .

I am having the Tables in the Users section of a Database and i want a Query to retrieve the Table name of the ColumnName (i written inside the Query )


Thank You.
John Mitchell-245523
John Mitchell-245523
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35858 Visits: 16699
I'm not sure what you mean, but have you tried the INFORMATION_SCHEMA.COLUMNS view?

John
Guitar_player
Guitar_player
Right there with Babe
Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)

Group: General Forum Members
Points: 763 Visits: 236
John Mitchell-245523 (7/9/2013)
I'm not sure what you mean, but have you tried the INFORMATION_SCHEMA.COLUMNS view?

John


Yes , I have tried using the basic names


SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS


but i am receiving invalid Table name or View .
The main Problem over here is that " The Tables are not in the Direct Database , they are inside to the Individual Users (Roles) who are in that Database
Sean Lange
Sean Lange
SSC Guru
SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)

Group: General Forum Members
Points: 64976 Visits: 17979
Guitar_player (7/9/2013)
John Mitchell-245523 (7/9/2013)
I'm not sure what you mean, but have you tried the INFORMATION_SCHEMA.COLUMNS view?

John


Yes , I have tried using the basic names


SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS


but i am receiving invalid Table name or View .
The main Problem over here is that " The Tables are not in the Direct Database , they are inside to the Individual Users (Roles) who are in that Database


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



_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Lowell
Lowell
SSC Guru
SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)SSC Guru (75K reputation)

Group: General Forum Members
Points: 75113 Visits: 40985
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!
Guitar_player
Guitar_player
Right there with Babe
Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)Right there with Babe (763 reputation)

Group: General Forum Members
Points: 763 Visits: 236
Yes,

Thanks for the guidence

I have used Query something like this to get all the Table columns which are having nearly same name like below


select u.owner AS OWNERNAME, u.table_name as Source_TableName,u.column_name as Source_Column_Name
from all_tab_columns u
where Upper(u.column_name) like upper('%Colun_Name%')



It worked fine i think.... but now i am facing another problem Please help me to find it

Can i get a Query to know the Owner name , Table name and Column name from the Entire Database which are having same
Employee name ("Employee1 ","Employee 2")

Through which i can get all the owners ,tables , columns which are having that Data
("Employee1 ","Employee 2")
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search