Is there a way I can use SQL Server management studio to find all columns that have column names that contain a certain substring?

Solution 1:

Mmhh you could try:

use <your_database>
select o.name,c.name 
from sys.columns c inner join sys.objects  o on c.object_id=o.object_id 
and o.type = 'U'
and CHARINDEX('<your_sub_string>', c.name)>=1

Solution 2:

You could use some 3rd party tools like Red-Gate's SQL Search that are free.


Solution 3:

You can use the INFORMATION_SCHEMA views.

USE <database>

SELECT COLUMN_NAME
     , TABLE_NAME     
 FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%<string you are looking for>%'

One catch is to make sure to USE the correct database.