I tried adding a cursor to the query before, but it told me I couldn't do this due to the local variables.
This is what I did:
Code:
DECLARE overdue_cursor CURSOR
FOR SELECT @email = dbo.tblUsers.user_email, @notes = dbo.tblActions.acti_notes, @subject = dbo.tblActions.acti_subjectFROM dbo.tblActions
INNER JOIN dbo.tblUsers ON dbo.tblActions.acti_user_id = dbo.tblUsers.user_id
WHERE (dbo.tblActions.acti_complete = 0) AND (dbo.tblActions.acti_due_datetime IS NOT NULL) AND (dbo.tblActions.acti_due_datetime > GETDATE())
OPEN overdue_cursor
FETCH NEXT FROM overdue_cursor