Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many rows were affected?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01075860
Message ID:
01076170
Vues:
16
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform