Added the ROWCOUNT to throw the error if nothing to return so no email is sent