TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Get Similar Column From All Tables
Pankaj Kumar Choudhary
Aug 03, 2016
3.2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
This blog explain that how to get all table name that contain a specific column.
To get all table name with specific column from database we will use the sys.columns and sys.table system view. We will use the below query.
Syntax
Select
t.
name
Table_Name, c.
name
column_Name
From
sys.columns
as
c
Inner
Join
sys.tables
as
t
on
c.Object_Id=t.Object_Id
Where
c.
name
like
'%Column_Name%'
Order
By
Table_Name, column_Name
Example
Select
t.
name
Table_Name, c.
name
column_Name
From
sys.columns
as
c
Inner
Join
sys.tables
as
t
on
c.Object_Id=t.Object_Id
Where
c.
name
like
'%Coaching%'
Order
By
Table_Name, column_Name
Output:
SQL Server
Next Recommended Reading
Select All Columns From A Table Except One Column