Wednesday, February 11, 2009

SQL Query to find out a particular field name across all tables in a Database

SELECT name FROM sysobjects WHERE id IN 
(SELECT id FROM syscolumns WHERE name = '<colname>')
another simple query to return all the column names.

select table_name,column_name from information_schema.columns where column_name like '%xyz%'

No comments: