How can i pass multiple query in a @query parameter in sp_send_dbmail?
For example:
select count(*) from TableA
IF count(*)/ @@rowcount = 0
Exec sp_send_dbmail @profile_name = xx, @recipients = '[email protected]',@subject = 'Test', @body= ' No rows';
IF count(*)/ @@rowcount > 0
Exec sp_send_dbmail @profile_name = xx, @recipients = '[email protected]',@subject = 'Test',
@body= ' xx rows';
I am not getting any error message, but it stops after the first select statement.