none
Multiprocess data access RRS feed

  • Question

  • Hi,

    I have a database table in SQL server which has some un-processed records (processed flag = 0). I have a batch program which is going to be executed from 2 separate machines for processing these records. My requirement is that I need to process half of records using batch running on first machine and second half using batch on the second machine. I also want that if a record has been picked up by one batch, it should not be picked up by the other if it runs a select statement statement on the table looking for all unprocessed records. After a record has been processed, its processed flag can be marked say '1'

    What is the best possible way to accomplish this? I do not want to use ROWLOCKS while selecting as it would hamper the access of all such records from the UI.

    Thanks

    Vedanshu

     

    Monday, May 16, 2011 10:45 AM

All replies

  • Hello Vedanshu,

    Thanks for your post.

    In my opinion, you could try to do this:

    Using LINQ, you can get the count of records, and select a half records, and then to make the machine A only to update this half of records. the same in the machine B, you can also using LINQ to get the other half of records, and machine B only updates the rest half of records. So, you needn't to set processed flag, and two machines do the separate job without confliting.

    Just my suppose, maybe you can try it.

    I hope this can help you.

     

    have a nice day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, May 19, 2011 8:29 AM
    Moderator
  • Hi Vedanshu,

    How about your issue, has it been resolved? If you still have any questions, please feel free to let me know.

     

    Good day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 31, 2011 3:13 AM
    Moderator