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
Post a Comment