Home Forums SQL Server 2008 T-SQL (SS2K8) how to replace this cursor with set based solution? RE: how to replace this cursor with set based solution?

  • Yes, I jumped to thank you but I am examining it. I agree, I must understand so I can reuse in other situations.

    I may have some more questions about this before i'm through. For example, did you use a temp table for Benches?

    eg.

    create table benches (Bench varchar(10));

    insert into benches

    values

    ('LabC1'),

    ('LabC2'),

    ('LabC3'),

    ('LabC4');

    ????? what did you do to handle array? For me to run your query I create a basic table called Benches, but in reality no such table exists (and won't exist). What assumption did you make to handle for the array @benches? A script populating a temp table?

    --Quote me