• wbellman (5/22/2014)


    So... something more like this. Here's a real world example from my job.

    Goal: To score a set of companies based on set business rules that vary from platform to platform. The score determines priority for a selection process. Each platform has a different set of rules.

    The original solution:

    1. Open cursor

    2. Determine platform

    3. Long if block to determine score based on company information

    4. Write result

    5. Rinse repeat

    I could go over the what we used to break apart the cursor... Actually for brevity sake I simplified the "Original solution." The actual original solution was a proc that had a cursor that called itself. We called it the recursive cursor. It was lots of fun.

    If you could provide some more specifics (ie example schema, sample data, etc...), I'd be happy to put together an article with a brief cursor intro, and then some specifics to tackle your problem, along with all of the reasons why a set-based approach beats the iterative approach every time : )