?
Solved

Is there a way to check all table columns in a database for a certain field.

Posted on 2014-02-18
3
Medium Priority
?
310 Views
Last Modified: 2014-02-18
The database name is "rpr_dev" and the field I want to find is called "zoneword". I'd like to know which table is that field in.
Thanks in advance
0
Comment
Question by:tesla764
[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
3 Comments
 
LVL 8

Assisted Solution

by:5teveo
5teveo earned 500 total points
ID: 39868491
SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
    JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%MyName%'
0
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 300 total points
ID: 39868502
>Is there a way to check all table columns in a database for a certain field.
Define 'field'.  Value in a column for a given row, column name, ...
0
 
LVL 11

Accepted Solution

by:
Simone B earned 1200 total points
ID: 39868512
Try this:

USE rpr_dev
go

SELECT a.[name] as ColumnName, b.[name] as TableName FROM sys.columns a
INNER JOIN sys.tables b ON a.object_id = b.object_id
WHERE a.[name] = 'zoneword'

Open in new window

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

770 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