>Fabio,
>>I like your suggestion. Very "clean" solution. I only have to make one change, changing @@ROWCOUNT>0 to @@ROWCOUNT=1 because one and only one record should be updated for each update statement.
>>
>>Do you see any problems with my modifiecation of your code below?
>>
>>
>>BEGIN TRAN
>>
>>UPDATE mytable SET Name = @Name1 WHERE Id = @Id1
>>
>>UPDATE mytable SET Name = @Name2 WHERE Id = @Id2 AND @@ROWCOUNT = 1
>>
>>UPDATE mytable SET Name = @Name3 WHERE Id = @Id3 AND @@ROWCOUNT = 1
>>
>>IF @@ROWCOUNT = 1
>> COMMIT TRAN
>>ELSE
>> ROLLBACK
>>ENDIF
>>
>
>If you update a pkey then "= 1" it is a more restrictive choice because it respect the
>update set domain,
>but if the database is consistent
>then formally "> 0 " and "= 1 " are equal.
>
>From the logical point of view, to write "=1" it means:
>- to check that @idN exists
>- to check that it is unique because you don't trust MS SQL
>
>Becuase "> 0" is invariant to a code variation done in future,
>if you have trust in MS SQL then i suggest "> 0".
Fabio,
Thank you for your reply. I understand what you are saying.
Einar
Semper ubi sub ubi.