sql server - mail from ssms using msdb.dbo.sp_send_dbmail -


i able email notification using below code:

exec msdb.dbo.sp_send_dbmail @profile_name = 'send mail', @recipients = 'xyz', @subject = 'email notification', @query= 'select count(*) employee;' 

the result number.

i want see result as: total employee = xx

am getting error following statement

@query= ' "total employee = " select count(*) employee;' 

error: incorrect syntax

please suggest correct way write @query part result in desired format.

your @query parameter should this:

@query= 'select ''total employee = '' + cast(count(*) varchar(10)) employee;' 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -