Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unexpected Behavior with UPDATE and ERROR
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00455711
Message ID:
00455840
Views:
33
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform