sql server 发送邮件
declare @html nvarchar(MAX), @subject nvarchar(MAX)='your subject', @ErrorNO int select @ErrorNO= ERROR_NUMBER() begin select @html= '<p>your message Insert Error. <br/>Error Number: </p>' + convert(nvarchar,@ErrorNO)+'<br/>ErrorMessage:'+ERROR_MESSAGE() exec msdb.dbo.sp_send_dbmail @PROFILE_NAME = 'SQL_Profile' , @RECIPIENTS = 'abc@abc.com' , @SUBJECT = @subject , @BODY = @html , @BODY_format = 'HTML' ,@Importance='High' end