You are here:  
TKC Blog
15

You might find the following two SQL queries handy. They find a string within the SQL code of a stored procedure or view.

-- Stored Procedure – looking for string ‘TEST’

SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%TEST%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)

-- View – looking for string ‘TEST’

SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%TEST%'
AND OBJECTPROPERTY(id, 'IsView') = 1
GROUP BY OBJECT_NAME(id)

Posted in: SQL Server

Comments

There are currently no comments, be the first to post one.

Post Comment

Name (required)

Email (required)

Website

Enter the code shown above:

Search Blog
TKC Blog Latest Articles
Blog Archive
 
Home | About Us | Benefits | TKC Blog | Contact Us