Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Function search?

Author  Topic 

Mckay
Starting Member

8 Posts

Posted - 2005-11-25 : 22:38:53
hi,

is there any function to search a string in every trigger and stored procedure?

Thanks

Regards
McKay

Kristen
Test

22859 Posts

Posted - 2005-11-26 : 05:11:21
[code]
SELECT DISTINCT O.xtype, O.[name]
FROM dbo.syscomments AS C
JOIN dbo.sysobjects AS O
ON O.id = C.id
WHERE [text] LIKE '%MySearchPhrase%'
ORDER BY O.xtype, O.[name]
[/code]
Use xtype in the WHERE clause to constrain by type, if required (this will include Views, Functions, etc.). ENCRYPTED objects will NOT be searched

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-28 : 00:50:04
also

select routine_definition from information_schema.routines
where routine_definition like '%searchString%'

and note that this will exclude triggers if any


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Mckay
Starting Member

8 Posts

Posted - 2005-11-28 : 03:55:24
hmm, if i don't make mistake...
i have ever use a system stored procedure in sql 7 to search a string ... but i forgot the stored procedure name.....?

Go to Top of Page
   

- Advertisement -