MSSQL , How to let row updated only once

50 views Asked by At

I have an table which has pre create rows. like

ID BilNo Field1 Field2

55 NULL blabldd blalala
56 48989 blalala blalala 

For Example record 56 cannot be updated , becase of BilNo is not null. Now I have an two process(Query) or more than two which use trancation.Assume

UPDATE mytable set BilNo=95945 Where ID=55; 

First process firstly lock the row for update . Second process is wait for first process to finish update , than update again. By the way each process has their own BilNo. I want a scerino like this. İf first operation is being update for this row. Second operation must not be wait for first operation. Second operation cannot start and breking suddenly.

1

There are 1 answers

0
Tan Wei Lian On