SQL Query to search schema of all tables

pencilslate picture pencilslate · Aug 12, 2009 · Viewed 125.7k times · Source

I am working on a SQL Server 2008 Db that has many tables in it (around 200). Many of these tables contain a field by the name "CreatedDate". I am trying to identify all the table schema with this particular field.

Is there a SQL query to do this?

Answer

Raj More picture Raj More · Aug 12, 2009

I would query the information_schema - this has views that are much more readable than the underlying tables.

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%create%'