SQL SERVER TUTORIAL IN DEPTH

The blog is to help users about sql server

Others

LightBlog

Breaking

Saturday 4 January 2014

How to find the text and get to know the stored procedure if you have lot of stored procedures

I have create a stored Procedure. As you know there are number of stored procedure and its tough to search a text if you want to find by text to know which sp has that text. The small technique is mentioned below.


alter proc usp_find_word
as
begin
select 'anuragggggggggggg'
declare @varrrrrrr varchar(50)
end

--------------------------------------------------------------------------------------------------------

SELECT OBJECT_NAME(object_id), OBJECT_DEFINITION(object_id)
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%anuragggggggggggg%'

SELECT OBJECT_NAME(object_id), OBJECT_DEFINITION(object_id)
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%@varrrrrrr%'

---------------------------------------------------------------------------------------------------------






Try this too

SELECT *, OBJECT_DEFINITION(object_id) ObjectDefinition
FROM sys.objects

WHERE OBJECT_DEFINITION(object_id) LIKE '%anuragggggggggggg%'






No comments:

Post a Comment

 test