Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 If a Column name exists in a database and where.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

10 Posts

Posted - 07/10/2014 :  09:46:15  Show Profile  Reply with Quote

I am trying to figure out how to find out if a Column name exists and where in a database. There are 123 tables.

Thank you,


In (Som, Ni, Yak)

17689 Posts

Posted - 07/10/2014 :  09:51:26  Show Profile  Reply with Quote
SELECT object_name(object_id) as table_name
FROM   sys.columns
WHERE  name = 'a_column_name'

similarly, you can also query INFORMATION_SCHEMA.COLUMNS to get the information you want

Time is always against us

Go to Top of Page

Starting Member

10 Posts

Posted - 07/10/2014 :  10:14:12  Show Profile  Reply with Quote
Thank you very much. That is exactly what I needed. You are a life saver.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000