I have to make a list of tables and their columns that are having keyword 'EMP' in their column name. The database is having around 160 tables. Is there any way of finding this quick ?
views:
26answers:
1
+3
A:
Give this a go
SELECT TABLE_NAME,
COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE '%YoutValue%'
ORDER BY TABLE_NAME,
ORDINAL_POSITION
EDIT
You could use
SELECT TABLE_NAME,
COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE '%YoutValue%'
OR COLUMN_NAME LIKE '%YoutValue%'
ORDER BY TABLE_NAME,
ORDINAL_POSITION
astander
2010-02-19 06:25:14
Yes its working thanks ! Further if i have to search column name i would just use in where clause COLUMN_NAME LIKE '%YoutValue%'
HotTester
2010-02-19 06:42:44