i have a sproc that i need to create and i want to make sure i am doing it correctly. i need to match new documents (which have several attributes) with subscribers that have preferences set to which documents they want to receive notifications for. here the steps i've come up with:
- schedule using agent
- select new documents with attributes into temp table
- loop through documents to find matching subscribers for that day and insert those records into 'Subscription' table.
- delete temp table
- send email based on those records in 'Subscription' table.
I'd appreciate any advice on how to opimize this, the number of records could become large and I want to make sure I am ready if it does.