I have created a job which executes a procedure which executes and creates logs of StartTime and EndTime and records affected. The last step of the job sends mails to recipients from the logs table. Though I get the info correctly I get all annoying dashes for 4-5 lines between each line of message.
Please help me to remove the dashes.
Below is the code i use to send mails.
EXEC msdb.dbo.sp_send_dbmail
@profile_name='SQL Mail Service',
@recipients='biscribbler@gmail.com',
@copy_recipients='biscribbler@gmail.com',
@subject='SOFT SCRUB Completed for LiveDB',
@query='exec PCMArchiva..APS_MailStats'
Procedure APS_MailStats contain below code:
DECLARE @tid INT = (SELECT MAX(TID) FROM APS_Audits)DECLARE @tih INT =(SELECT DATEDIFF(HH ,StartTime ,EndTime) FROM APS_Audits WHERE TID = @tid)
,@tin INT = (SELECT DATEDIFF(N ,StartTime ,EndTime)%60 FROM APS_Audits WHERE TID = @tid)
SELECT 'Hi All,'
SELECT 'PCM SoftScrub Process for LiveDB has completed successfully'
SELECT 'Summary : ' + LTRIM(RTRIM(comments)) FROM APS_Audits WHERE CONVERT(DATE ,EndTime) = CONVERT(DATE ,GETDATE())
AND TID = (SELECT MAX(TID) FROM APS_Audits)
SELECT 'Time Taken for this execution :' +CONVERT(VARCHAR ,@tih)+':'+CONVERT(VARCHAR ,@tin)