>Thank you for your reply.
>
>If I understand correctly to use RowVersion I can do something like
>UPDATE Table SET... WHERE RowVersion=myRowVersion.
>
>And if the RowVersion was changed the update will not happen.
>But by that time all the changes that user made during his session will be gone and I am not sure how would I know that the change was not saved and let user know why.
>You mention a comparison, how do I go about it? I am sorry if my questions are too dilettante.
>
>Thank you again
>
>
You will do something like (from the top of my head)
if exists (select 1 from myTable where Pk = @myPK and RowVersion <> @MyRowVersion)
begin
select @Col1Changed = Col1, @Col2Changed = Col2 from myTable where Pk = @myPk
raiserror('While you were working, another user has changed the data and the new values are: Col1 = %s, Col2 = %s',16,1,@Col1Changed, @Col2Changed)
return - 1
end
else
If it's not broken, fix it until it is.
My Blog