Hi,I have the following code to send out an email if the row count of a table exceeds a certain number. But it seems to fire an email alert no matter what. Can someone correct my condition check part of the code? Thank you in advance!!!use msdbgocreate table ##resultset (total int)insert into ##resultset (total) Select Count(*) from tabledeclare @total intselect total from ##resultsetif (@total) >= 20 --send email to the required recipents USE msdb EXEC sp_send_dbmail @profile_name = 'profile', @recipients = 'emal address', @subject = 'Current Count of Docs', @body = 'The current count of docs', @execute_query_database = 'msdb', @query = 'select total from ##resultset'drop table ##resultset
↧