Find any column names inside Tables

Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 722
1st way:-
select name as 'table_name' 
from sysobjects
where id in(select id from syscolumns
where name like '%relationship_value%');
2nd way:-
select table_name
from information_schema.columns
where table_name in(select name from sysobjects
where xtype = 'u')
and column_name like '%relationship_value%';

Here,you can pass any column name instead of relationship_value.

Comments or Responses

Login to post response