May 6, 2005 at 12:31 pm
I have a need to find out which tables in a DB contain a column name, say department. Does anyone know of a T-SQL query I can write to do this? Thanks.
May 6, 2005 at 12:32 pm
Select * from INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'Departement'
May 6, 2005 at 12:53 pm
Thanks so much, one of our vendors is changing a column, which appears in many tables. Guess what? They forgot to do it in 2 tables!!. Charger. (By the way this will be a very valuable query in the future). Thanks again.
May 6, 2005 at 12:54 pm
I like to use this so I only get the User tables.
SELECT obj.name
FROM syscolumns col
, sysobjects obj
WHERE col.id = obj.id
AND col.name = 'Department'
AND obj.xtype = 'U'
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply