Solved

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

Posted on 2014-02-18
3
291 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
3 Comments
 
LVL 8

Assisted Solution

by:5teveo
5teveo earned 125 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 65

Assisted Solution

by:Jim Horn
Jim Horn earned 75 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 300 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

815 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