TSQL putting text on new line working within one SQL 2008 Agent job but not within another on same SQL Server?

Hello, coming across a strange behavior in that I successfully created a SQL Agent job as:

DECLARE @body_message nvarchar(max) = 'Message body here for Line 1.' + CHAR(13) + CHAR(10) + 'Message body here for Line 2.'

EXEC msdb.dbo.sp_send_dbmail @profile_name='SQLProfileName',
@recipients = 'RecipientEmail@hotmail.com',
@body = @body_message,
@subject = 'Subject Here.'

But when using the same exact above coding as a template model for another job on same SQL Agent server it keeps the @body as 1 line only instead of 2 separate lines which is what I'm aiming to do.

Is there a setting within a SQL Agent job that needs to be adjusted in explaining this inconsistent behavior?

Thanks in advance.

August 19th, 2015 7:07pm

Guess never mind as it's working now in that odd the 2nd job @body_message didn't have a '.' (period symbol) at the end of it's string sentence which when simply adding period symbol it looks like it now work.

Thanks anyways.

Free Windows Admin Tool Kit Click here and download it now
August 19th, 2015 7:18pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics