Friday, October 16, 2009

Find the Column Name in a Table which is in a database

You might encounter this problem...You forget the tablename where a column recides...
Inorder to search the column name where it is in a table
use this in SQL Server


SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%employeeId%' )


This will search the current database and returns all the rows of sysobject (tables,views,storeproc,function etc., )which has this columnname employeeId.

No comments:

Post a Comment