I'm trying to make an update on a table which fails (as it should because of constraints). This causes an sql error.

I then try to select all rows in a table using a declare. When I check the state it says there is an sql error.
The error however is from the attempted update (I...