Thursday, 14 November 2013

Find any string match in store procedure.

Find any string match in store procedure.




SELECT DISTINCT OBJECT_NAME(OBJECT_ID)
     ,object_definition(OBJECT_ID)
FROM sys.Procedures
WHERE object_definition(OBJECT_ID) LIKE '%' + '<<StringTextValue>>' + '%'

Find Store procedure, modified in specific range



Find Store procedure, modified in specific range


SELECT name as Store_Procedure_Name
FROM sys.Procedures
Where modify_Date >=  <<Datevalue>> AND modify_Date <=  <<Datevalue>>

Find column name match in tables


Find column name match in tables


SELECT sys.Tables.NAME AS TableName
     ,sys.columns.NAME AS ColumnName
FROM sys.columns
INNER JOIN sys.Tables ON sys.Tables.object_id = sys.columns.object_id
WHERE sys.columns.NAME LIKE '<<Column Name>>'