Solved

I need a select statement that will search a database and return the tablename that a specific field lives in.

Posted on 2015-01-12
4
105 Views
Last Modified: 2015-01-12
I need a select statement that will search a database and return the table name that a specific field lives in.
0
Comment
Question by:bjbrown
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 40544584
Something like this?
SELECT OBJECT_NAME(id)
FROM syscolumns
WHERE name='ColumnNameHere'

Open in new window

0
 

Author Comment

by:bjbrown
ID: 40544598
Exactly what I was looking for. Thank you Vitor !!!
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 40544605
Select
  O.name objectName
from sys.columns C
inner join sys.objects O
  ON C.object_id=O.object_id
where C.name ='yiurcolumnname'
0
 

Author Comment

by:bjbrown
ID: 40544659
Darrol,

This select statement worked as well, thank you for your submission.

Brian
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now