So I know how to concatenate my <Carriage Return> <Line Feed> for my Email message...
DECLARE @Temp VARCHAR(MAX), @NewLineCRLF CHAR(6), @EmailMessage VARCHAR(MAX) SET @NewLineCRLF = '[CRLF]' UPDATE [dbo].[#TempTable_Files_EMail_Message] SET[#TempTable_Files_EMail_Message].[EMailMessage]= [#TempTable_Files_EMail_Message].[EMailMessage] + @NewLineCRLF + 'Test Line 2' WHERE [#TempTable_Files_EMail_Message].[MailID] = 1 ; UPDATE [dbo].[#TempTable_Files_EMail_Message] SET [#TempTable_Files_EMail_Message].[EMailMessage] = [#TempTable_Files_EMail_Message].[EMailMessage] + @NewLineCRLF + 'Test Line 3' WHERE [#TempTable_Files_EMail_Message].[MailID] = 1 ; SELECT @Temp = [#TempTable_Files_EMail_Message].[EMailMessage] FROM [dbo].[#TempTable_Files_EMail_Message] SET @Temp = REPLACE([#TempTable_Files_EMail_Message].[EMailMessage],'[CRLF]',CHAR(13)+CHAR(10)) PRINT @Temp
And I understand the "PRINT" will then properly format it. I get that. But I then have to provide that properly formatted Email Text into the Stored Procedure.
EXECUTE [dbo].[sp_send_dbmail] @recipients = 'Email.Recipient@Domain.com', @profile_name = '2012_DBA', @subject = 'Test Subject', @body = @Temp, @importance = 'High', @body_format = 'HTML'
How can I get the "PRINT @Temp" into a variable that the Stored Procedure can then use???
Or am I way off here???
Any help is greatly appreciated.
Thanks in advance for your review and am hopeful for a reply.
PSULionRP