superbun1
superbun1

Reputation: 129

Where to find stored procedure msdb.dbo.sp_send_dbmail in SQL Server

I need to look at the code for stored procedure msdb.dbo.sp_send_dbmail in SQL Server. Could someone tell me where to look for the stored procedure in SQL Server Management Studio 2008.

Upvotes: 10

Views: 33038

Answers (3)

marc_s
marc_s

Reputation: 754220

Right there:

enter image description here

As the name already tells you - it's in the msdb database (which is under the System Databases), and the stored proc can be found under Programmability > System Stored Procedures

Upvotes: 20

Martin Smith
Martin Smith

Reputation: 452947

From the Object Explorer node for your instance expand...

Databases -> System Databases -> msdb -> Programmability -> 
              Stored Procedures -> System Stored Procedures

Or (having seen Joe's answer) one non UI method

use msdb;

SELECT object_definition(object_id('dbo.sp_send_dbmail')) 
AS [processing-instruction(x)] FOR XML PATH('')

Upvotes: 5

Joe Stefanelli
Joe Stefanelli

Reputation: 135729

USE msdb;
GO

sp_helptext 'dbo.sp_send_dbmail';

OR

USE msdb;
GO

SELECT definition 
    FROM sys.sql_modules 
    WHERE object_id = OBJECT_ID('dbo.sp_send_dbmail');

Upvotes: 8

Related Questions