Tuesday, July 1, 2008

SQL Script to get definitions for procedures, functions, and views

-- This procedure will allow you to get the definition for the raw SQL
-- that is used to create the stored procedures, functions, and views

USE
[db_name];

SELECT TOP 200
all_objects.object_id
, name
, definition
, type_desc
, type --P=Stored Procedure, V= View, FN = Function
FROM sys.all_objects
INNER JOIN sys.sql_modules
on all_objects.object_id = sql_modules.object_id
--Use the to find specific definitions
WHERE
definition like '%nolock%'

No comments: