Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get Similar Column From All Tables
WhatsApp
Pankaj Kumar Choudhary
8y
3.4
k
0
0
25
Blog
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
Up Next
Select All Columns From A Table Except One Column
Ebook Download
View all
Basics of SQL Server
Read by 1.6k people
Download Now!
Learn
View all
Membership not found