[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
Medium Priority
?
122 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
Vitor Montalvão earned 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

656 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