• I, too, don't have a problem with a cursor per se here; it could be done w/o one, but it's not a big deal for such a limited number of rows.

    You should get away from "sysusers", which is also obsolete, but again that's not a killer issue either.

    But, the cursor should be optimized with FAST_FORWARD:

    ...

    declare updateServerroles cursor fast_foward for SELECT name FROM sysusers where name = 'TEST\user'

    ...

    Edit: Corrected typo.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.