Hi All!
Simple problem, I'm missing something.
I have this at the end of my statement
IF
@@ROWCOUNT = 0EXEC
msdb.dbo.sp_send_dbmail@recipients
=N'jrudolf@ikon.com',
@body
= @body,@body_format
= 'HTML',@Subject
='NO RECORDS TO DELETE',@profile_name
= 'Ikon'
Else
EXEC
msdb.dbo.sp_send_dbmail@recipients
=N'jrudolf@ikon.com',@body
= @body,@body_format
= 'HTML',@Subject
='PLEASE REVIEW RECORDS',@profile_name
= 'Ikon'END
I'm thinking when it returns 0 rows it should do the first email, else it should do the second email. But it's always doing the second. And I know it's 0 rows, because I'm not getting any results. And I made sure of it.
Thanks!
Rudy