Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How many rows were affected?
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01075860
Message ID:
01076170
Views:
25
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
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform