Using T-SQL to Update and Delete Mail Objects

To delete or update profiles, accounts, profile-account associations, and profile security settings (note: do so in reverse order), you use the stored procedures shown in Table 12.1.

Image

TABLE 12.1 T-SQL Stored Procedures

For example, to delete a profile, you execute this:

EXEC msdb.dbo.sysmail_delete_profile_sp @profile_name='Undesireable Profile Name'

To update a profile’s security, changing it from the default to the nondefault profile, you execute the following:

EXEC msdb.dbo.sysmail_update_principalprofile_sp    @profile_name = 'Default ...

Get Microsoft SQL Server 2014 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.