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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Function search?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mckay
Starting Member

8 Posts

Posted - 11/25/2005 :  22:38:53  Show Profile  Send Mckay a Yahoo! Message  Reply with Quote
hi,

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

Thanks

Regards
McKay

Kristen
Test

United Kingdom
22859 Posts

Posted - 11/26/2005 :  05:11:21  Show Profile  Reply with Quote

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]

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

India
22864 Posts

Posted - 11/28/2005 :  00:50:04  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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 - 11/28/2005 :  03:55:24  Show Profile  Send Mckay a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000