To find a column name in entire database or get all the tables where this column name appear!
And then generate dynamic SQL on that table
SELECT
‘SELECT * FROM’
+’ ‘
+NAME
+’ ‘
+’WHERE someCondition=value’
–here some condition if you want
FROM sys.tables
WHERE object_id in
(
SELECT object_id FROM sys.columns
–column/field name you are trying to find in
–database
WHERE NAME=’colName’
–remove this condition if you are generating for all tables )
Leave a Reply