SQLServer-DBA.com Links

Subscribe to newsletter

Dba_db2_button

Powered by TypePad
Search for text in stored procedures - 2000 - 2005 - 2008 - 2012

20 March,2007 by Jack Vamvas

Search for text in stored procedures is useful, a typical example is object renaming\remapping.

There is one example for SQL Server 2000 and two examples for SQL Server 2005 - 2008 - 2012

USE MyDatabase
GO
-----SQL Server 2000
SELECT DISTINCT so.name ,so.xtype
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%myText%'
ORDER BY so.name


-----SQL Server 2005 - 2008 - 2012
GO

SELECT DISTINCT o.name AS Object_Name,o.type_desc
FROM sys.sql_modules m 
INNER JOIN sys.objects o 
ON m.object_id=o.object_id
WHERE m.definition LIKE '%some_text%'
AND o.type='P'



 Related Posts

Stored Procedure Checklist

SQL Stored Procedure Commenting


Author: Jack Vamvas (http://www.sqlserver-dba.com)

******** *******

Subscribe to SQLServer-DBA.com

Latest posts delivered to you daily

Delivered by FeedBurner

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer