Link to home
Start Free TrialLog in
Avatar of sl1nger
sl1nger

asked on

search query to find column name

I use to have a query that would search for an existing column and then return the table name.

however, I'm having a hard time finding it, can anyone help me re-create?

SOLUTION
Avatar of mcv22
mcv22
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
select
o.name as tableName,
c.name as ColumnName,
o.type as ObjectType,
u.name as SchemaName
from syscolumns c
inner join sysobjects o
on o.id=c.id
and o.xtype = 'U'
inner join sysusers u
on u.uid= o.uid
where
c.name like '%RANGE%'
and o.name = 'tablename'
ORDER BY 1,2