Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Query to Find table name from Database having specific column

Some days ago I need to find a table name where a column exist or not. There were around 100 tables, So i need to find a time saving solution. Around net I found a solution for that which solved my problem in a minute. In a community form I found the solution. Solution is given below.

SELECT t.name AS table_name,
SCHEMA_NAME
(schema_id) AS schema_name,
c.name AS column_name
FROM
sys.tables AS t
INNER
JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE
c.name LIKE '%City%'
ORDER
BY schema_name, table_name;
Share this article   |    Print    |    Article read by 3934 times
Author:
Rohit kakria
I am software developer
Related Articles:
Related Interview Questions: