|
|
Cry How to...List all tables that contain a given column nameTo list all the tables in an SQL Server database that contain a given column name, use the following SQL: select sysobjects.name, * from syscolumns, sysobjects where syscolumns.name='MyColumn' and sysobjects.id = syscolumns.id and (sysobjects.xtype='U' or sysobjects.xtype='S') Note:
These notes have been tested against SQL Server 7 and SQL Server 2000. About the author: Brian Cryer is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant. |