SQL Msg 18054, Level 16, State 1

Today I received a seemingly simple task — to modify a piece of data in a database. Sounds simple enough.
A search on the Internet soon pieced together the corresponding SQL statement:

UPDATE [suivi].[dbo].[numSerie]
SET ni_numCible = ‘HF17263N7P13340’
WHERE ni_num = ‘HF17262A1400234’

As you can see from the above statement, the task is simple. In the [suivi].[dbo].[numSerie] table, find the record ni_num = ‘HF17262A1400234’ and set the ni_numCible field for that record to ‘HF17263N7P13340’.
Unexpectedly, after the above statement is executed, the following prompt appears:

Msg 18054, Level 16, State 1, Procedure tg_InsUpdCible, Line 31
Error 50010, severity 16, state 1 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
Msg 3609, Level 16, State 1, Line 1
The transaction ended in the trigger. The batch has been aborted.

After the execution should not appear “XX Rows Afftectd”, as SQL small white, for this pile of prompts, it means that I do not understand.
Well, Google it, OK, and see the first result.
It looks like I got the same error message, so take a closer look. The following code is found:

/*Check for valid parameter*/
If LEN(@txtbidderid) =0 or ISNULL(@txtbidderid, ") = "
RAISERROR(50002,10, 1,'Error Accessing Bidder Record - Must Provide Bidder ID')
ELSE

The Error 50002 obtained by the author should be output here, then my next work should be to find where the file I output Error 50010 here is, after finding out, why should I throw Error 50010 to me, how to avoid it will be easily solved!
I don’t know what kind of file the author posted. After searching for a few key words in this file, I get trigger. This means that the insert \ UPDATE \ DELETE operation will automatically trigger some operations. But where’s this trigger?Let’s find out.

Check the contents of the highlighted file in the figure above, and sure enough, it says under what conditions Error 50002 will be thrown.
Right-click the file and, alas, there isa Disable menu that appears to Disable the trigger.
After disabling the trigger, go back to the original SQL statement in this article and you’re done! And then the trigger is enabled. OK, mission accomplished!
For those of you who know a little bit about SQL, this little problem today should be very easy to solve. But for someone like me who knows very little about SQL, it can be a real threat. Record the process of solving the problem now, is to provide the solution to the rest of the same problems, more important is to remind yourself, have a problem, the key is to solve the problem, don’t encounter a problem, find a pile of related tutorials to begin again chew, this can’t be sure, there is no doubt that this will give up less than half an hour. Always take the solution of the current problem as the fundamental goal, step by step, the problem will be solved naturally.

Reproduced in: https://www.cnblogs.com/outs/p/7730733.html

Read More: