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

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
tesla764Asked:
Who is Participating?
 
Simone BConnect With a Mentor Senior E-Commerce AnalystCommented:
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
 
5teveoConnect With a Mentor Commented:
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
 
Jim HornConnect With a Mentor Microsoft SQL Server Developer, Architect, and AuthorCommented:
>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
All Courses

From novice to tech pro — start learning today.