views:

330

answers:

4

My everyday IDE is Eclipse which has a wonderful Open Resource feature (CTRL+SHIFT+R or Navigate > Open Resource) which allows the user to search for files/resources across multiple projects.

I can't find a similar feature in SQL Server Management Studio, is there one?

A: 

I hope someone has a better answer to this than I do. In the past, I've used a CURSOR to search through all the databases and insert results into a temp table. I could then select from the temp table and show the results.

I don't have this code laying around anymore. If no one comes up with a better answer, I'll come back and edit this with some real code. I would think that there'd be a DMV for this. Anyone?

Micky McQuade
+1  A: 

No. There is no default mechanism in SMS to be able to search across projects.

Josef
A: 

You can search for objects in a sql database using the Information Schema Views http://msdn.microsoft.com/en-us/library/ms186778.aspx There's one for tables, columns, functions, sprocs, etc.

select * from INFORMATION_SCHEMA.routines where ROUTINE_DEFINITION like '%xp%_'

Booji Boy
A: 

You could use sp_MSforeachdb like so:

sp_MSforeachdb 'SELECT * FROM ?.INFORMATION_SCHEMA.routines WHERE ROUTINE_TYPE = ''PROCEDURE'''

The above will select all procedures across all databases and return them in different result sets. Using different views, you can also select tables, columns and so forth.

Mark S. Rasmussen