Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unexpected Behavior with UPDATE and ERROR
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00455711
Message ID:
00455840
Vues:
34
>Why would this statement cause an error? Are you passing incompatible data types?
>
>>UPDATE Company
>> SET Price = @Price
>> WHERE CompanyID = @CompanyID

It is not a SQL error, but a programming error if @CompanyID does not exist. I mistakenly thought SQL Server would generate an error if someone is trying to update a record that does not exist.

>>SET @ErrorNo = @@ERROR, @RowCnt = @@ROWCOUNT
>
>Replace the SET with a SELECT and everything should work.

Perfect, thanks!
Chris McCandless
Red Sky Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform