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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 I con' undestand infomation_schema.column

Author  Topic 

ashtu
Starting Member

10 Posts

Posted - 2008-04-20 : 08:51:37
Hi

I need to find the tables in which a particular column exists in the database. Please provide me an appropriate query.
your answer is.......

select table_name,column_name from information_schema.columns where column_name like '%bill%'
and i have done from my database
select ActionMaster,ActionName from information_schema.columns where ActionName like '%Test%'
then ERROR Like that
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ActionName'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ActionMaster'.
Msg 207, Level 16, State 1, Line 1
Invalid column name 'ActionName'
give the right solution........



Ashish

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-04-20 : 09:17:45
you mean in which column in the whole database some value exists?
you want to search the whole database for a particular value?
http://weblogs.sqlteam.com/brettk/archive/2005/02/08/4144.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-20 : 13:34:56
select tablename,columnname from information_schema.columns where columnname like '%bill%'

have a look at catalog views to get moore info on table columns:-

http://developer.mimer.com/documentation/html_91/Mimer_SQL_Engine_DocSet/Data_dic_views2.html#1167517
Go to Top of Page
   

- Advertisement -