|
The following query is used to fill a cursor. I only want one row in the cursor for each PlmName I need the fields to process data within the cursor. How do I load the cursor with one row of data related to PlmName?
(comments are locked)
|
|
It seems to me that the simplest way is to just take the email out of the select distinct clause. That should give you 1 row per name. Then to get the email, you can do a sub-select.
(comments are locked)
|


I don't get it. You have a query, which you use to populate a cursor now. Apart from a cursor-based solution probably being unnecessary and definetily being inefficient: What's the problem with what you have so far? What does it result in, and how does it differ from your desired result?
Yeah, I'm at a loss to understand what's needed here too. Also, in general, if you find yourself thinking in terms of "FOR EACH" in SQL Server, you might be digging a hole. Always think in terms of sets and batches. That's how the T-SQL language usually works best.
Sorry to bug you. I modified how I was filling the cursor and the email that is sent within the cursor now sends a nicely formatted table with the data so that each representative will only receive one email every night with the data they need to pay attention to.
So is this no longer a problem for you?