Solved

How do I find the table SQL stored new data to.

Posted on 2013-01-18
7
202 Views
Last Modified: 2013-01-18
Can anyone share a script that can help me locate the table in my database that holds a column named Pinto ?
0
Comment
Question by:GD_GRAY
7 Comments
 
LVL 69

Assisted Solution

by:ScottPletcher
ScottPletcher earned 334 total points
Comment Utility
USE <db_name>

SELECT OBJECT_NAME(object_id), *
FROM sys.tables
WHERE name = N'Pinto'
0
 
LVL 41

Assisted Solution

by:ralmada
ralmada earned 166 total points
Comment Utility
try

select OBJECT_NAME(object_id)
from sys.columns
where name = N'Pinto'
0
 
LVL 26

Expert Comment

by:Zberteoc
Comment Utility
select TABLE_NAME from information.schema.columns where COLUMN_NAME='Pinto'
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
If you want to search wider then just columns in tables (for example which SP use it?), check http://www.red-gate.com/products/sql-development/sql-search/
0
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 334 total points
Comment Utility
CORRECTION: I meant "sys.columns" instead of "sys.tables":


USE <db_name>

SELECT OBJECT_NAME(object_id), *
FROM sys.columns
WHERE name = N'Pinto'
0
 

Author Comment

by:GD_GRAY
Comment Utility
I guess the column insert into the data base must add some sort of prefix to the column ID. Im not able to find it in the data base at all. How about a way to search the full data base for a unique value that would be found in that same table and column. Do you happen to know how to do that ?
0
 

Author Closing Comment

by:GD_GRAY
Comment Utility
I found a script to do what I need. Thanks
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 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

8 Experts available now in Live!

Get 1:1 Help Now