Pages

Mar 15, 2018

Finding specific text in SQL procedures of a database

Task: Got a new change request where source systems added new column to their object which also needs to be added in SQL procedure. The source system object is not familiar to me by looking. I have to check whether or not there is any SQL object using by this view.

Work Around: We can use scripts in different ways, I have used the below.


USE [DB Name]
GO

SELECT Scehma=schema_name(o.schema_id), o.Name, o.type ,m.definition
FROM sys.sql_modules m
INNER JOIN sys.objects o
ON o.object_id = m.object_id
WHERE m.definition like '%XXNHR_GET_ITEM_DETAIL%'
GO



No comments: