I have a SQL agent job that runs several UPDATE statements. What I want is to have it send of an email after it runs everyday. I get the emails but it doesn't show the number of rows affected or anything. Here is what I have.
--Print @tableHTML
DECLARE @eSubject varchar(250)
DECLARE @emailTo varchar(250)
SET @eSubject = 'Number of rows updated'
SET @emailTo = 'me@me.com'
EXEC msdb.dbo.sp_send_dbmail @recipients=@emailTo,
@subject = @eSubject,
@body = @@ROWCOUNT,
@body_format = 'HTML';
This will kind of work but what I would rather have is
--Print @tableHTML
DECLARE @eSubject varchar(250)
DECLARE @emailTo varchar(250)
SET @eSubject = 'Number of rows updated'
SET @emailTo = 'me@me.com'
EXEC msdb.dbo.sp_send_dbmail @recipients=@emailTo,
@subject = @eSubject,
@body = @@ROWCOUNT + 'row(s) affected by UPDATE',
@body_format = 'HTML';
However, i get syntax errors due to the '+' after @@ROWCOUNT.