Search code examples
sqlstored-proceduressql-server-2000

Find a stored procedure name with its content in SQL Server 2000


For a stored procedure, I have its full source code. But the name of that stored procedure has been lost. In this database, there are hundreds of stored procedures.

So is there a way by which I can find out the name of the stored procedure by using its contents or by using any of the variables in the contents?

This is puzzling me a lot. A help would be sincerley appreciated.


Solution

  • Try this:

    select * from sysobjects where id in 
    (select id from syscomments where text like '%exec%')
    order by [name]
    

    where 'exec' is the text you're searching for. This query will search views also, just fyi