AnOldNew_Coder AnOldNew_Coder - 1 month ago 7
SQL Question

Can I locate tables based on a column value?

I am working without documentation we have a dental system that displays the status of an appointment.
I have to report on who scheduled the appt. and who confirmed. The systems displays this as 'FIRM' and 'FIXED. I have located how they store the person who scheduled the appt. but not who has confirmed it.

But since they use 'FIRM" is there a way I can locate which tables have this value? we are running sql server 2008.

Answer Source

you can find out the table name which have column name like FIRM by using below query -

select * from information_schema.columns where column_name like '%FIRM%'      

if you want to know where this column is referred (like in SP , trigger or view) or a or hard coded value is used to display, you can use below query-

select distinct object_name(id) from syscomments  where text like '%FIRM%'