• SomewhereSomehow (9/24/2012)


    You may use output clause to output the affected rows back to client

    Smth like this.

    with u as (select top(1) * from ATH_SyncEntities where Status = 0 order by EntityType, ID)

    update u set Status = 1

    output inserted.Id, inserted.EntityId, inserted.EntityType, inserted.EntityOperation, inserted.Status

    Thanks, works like a charm...

    btw, do you want to update only one id at a time...

    Yes, there's a trigger that whenever an entity is updated inserts a row on a sync entities table.

    There are some workers that read from that table an send the record to another database on another server.

    Each worker must only read an entity at a time..

    Thanks again,

    Pedro



    If you need to work better, try working less...