Thursday, June 24, 2010

Sql Query for specific column for the Database

Here is a SQL query, where we get the  list of table names  which contain a specific column.

Ex: Column name = internalOrderNumber.

If I want to know in how many tables this column name is present, here is a query which gives the result !!

SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns WHERE name like '%InternalOrderNumber%' ) and xtype='U'

0 comments:

Post a Comment