toggle value

  • Hi all,

    I have table and want to do the following procedure on it.

    The field (beingused) in table test, I want to toggle the value of 1 or 0 if user is using the record it stays 1 and if user not using that record it goes to 0.

    will this can be done? if then how can is do this?

    Thanks

     

  • Are you thinking of using this method to lock records from further updates by different users?? If it's the case then you could use a timestamp column which is modified by sql server everytime a user makes a change in the row. When implemented you can simply check if the current record's timestamp matches the timestamp on the server and block the update if they don't match.

  • no i am trying to prevent other user from edit in record at the same time one user accessing the same record.

  • What I proposed will do it... but you will have to code something on the client side to check if the record has been updated, if yes then fetch the new data and ask the user if they still want to update the record or something like that.

  • You may want to set the appropriate transaction isolation level, see the list in Books Online.

    Yelena

    Regards,Yelena Varsha

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply