We are doing some updates to the definition of a certain column in one of our tables.
This column (for reasons I won’t go into here) appears in more than one table. I wanted to make sure that if the column was duplicated in other tables that the definition for the column was updated in the other tables too.
We’re using SQL Server in this case, and it’s actually very easy to find out this information. You just need to query the
INFORMATION_SCHEMA – this is where SQL Server stores metadata about tables etc.
USE myDatabase; SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG = 'myDatabase' AND COLUMN_NAME = 'myColumnToUpdate'
There is lots of other data stored in the
INFORMATION_SCHEMA – see the full MSDN documentation here.