Skip to main content

Posts

Showing posts from May, 2021

Script out EXISTING database mail profile's settings

  Script which will script out your present SQL Server 2016 Database Mail profiler Setup and Configuration Scripts. It will give you the script to Drop and create Settings For DatabaseMail profiles. Note: Tested on SQL 2005, to SQL Server 2016 Versions. USE msdb GO Declare @ TheResults varchar ( max ), @ vbCrLf CHAR ( 2 ) SET @ vbCrLf = CHAR ( 13 ) + CHAR ( 10 ) SET @ TheResults = ' use master go sp_configure ''show advanced options'',1 go reconfigure with override go sp_configure ''Database Mail XPs'',1 --go --sp_configure ''SQL Mail XPs'',0 go reconfigure go ' SELECT @ TheResults = @ TheResults + ' -------------------------------------------------------------------------------------------------- -- BEGIN Mail Settings ' + p . name + ' -------------------------------------------------------------------------------------------------- IF NOT EXISTS(SELECT * FRO