Hi, Have you ever try to insert a row in to a SQL table if the key does not exist and update a row if a key exists. Well this is very common scenario. Usually you would achieve this goal by writing SQL like: if exists ( select * from TestTable where ID = @id ) begin update TestTable set myCount = myCount + 1 where ID = @id end else begin insert into TestTable values ( @id , 1 ) end This code will work fine for single threaded applications but will not work for multiple threads application. To solve...