SQL Server/T-SQL Tutorial/System Tables Views/sys.sql modules
Displays the trigger SQL definition (if the trigger is not encrypted)
<source lang="sql">
4> 5> SELECT o.name, m.definition 6> FROM sys.sql_modules m 7> INNER JOIN sys.objects o ON 8> m.object_id = o.object_id 9> WHERE o.type = "TR" 10> GO name
definition
---------------------------------------------------------------------------------------------------------------
1></source>
Reporting Stored Procedure Metadata
<source lang="sql">
4> 5> SELECT definition, 6> execute_as_principal_id, 7> is_recompiled, 8> uses_ansi_nulls, 9> uses_quoted_identifier 10> FROM sys.sql_modules m 11> INNER JOIN sys.objects o ON 12> m.object_id = o.object_id 13> WHERE o.type = "P" 14> GO definition
execute_as_principal_id is_recompiled uses_ansi_nulls uses_quoted_identifier
----------------------- ------------- --------------- ----------------------
create procedure dbo.sp_MSrepl_startup as
exec sys.sp_MSrepl_startup_internal NULL 0 0 0
create procedure dbo.sp_MScleanupmergepublisher as
exec sys.sp_MScleanupmergepublisher_internal NULL 0 1 0
1></source>