Today I received a seemingly simple task--modifying a data in a database. It sounds simple.
After searching the Internet, we quickly pieced together the corresponding SQL statements:
UPDATE [suivi]. [dbo]. [Numserie]
SET ni_numcible = ' hf17263n7p13340 '
WHERE ni_num = ' hf17262a1400234 '
Through the above statement can also be seen, the task is very simple, in [suivi]. [dbo]. In the [Numserie] table, look for a record of ni_num = ' hf17262a1400234 ' and set the Ni_numcible field of the record to ' hf17263n7p13340 '.
Unexpectedly, after executing the above statement, the following prompt appears:
MSG 18054, Level A, State 1, Procedure tg_insupdcible, line 31
Error 50010, severity, State 1 is raised, but no message with that error number is found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
MSG 3609, Level A, State 1, line 1
The transaction ended in the trigger. The batch has been aborted.
After the execution is not supposed to appear "xx Rows afftectd", as SQL small white I, for this a lot of information, said not understand.
OK, search on Google, OK, just look at the first result.
It looks like I got the wrong message, so take a closer look. The following piece of code was 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 author gets the error 50002 should be the output here, then my next job, it is to find me here output error 50010 where the file, find, why to give me the error 50010 is clear, how to avoid also solved!
But what the author is posted is a file, do not know, in turn searched for several keywords in the file, I get to the concept of trigger, to the effect that the Insert \ Update \ Delete operation before or after, will automatically trigger some actions. But where is this trigger, come and find it.
View the contents of the highlighted file, sure enough, it shows, under what conditions, will throw out Error 50002.
Right click on the file, hey, there is a Disable menu that looks to disable this trigger meaning.
After disabling the trigger, then execute the original SQL statement in this article, success! Finally, the trigger will be enabled. OK, Mission Accomplished!
Today's small problem, for a little bit of SQL, should be very easy to solve. But for those of me who know very little about SQL, it is formidable enemy. Now the process of solving the problem is recorded, one is to meet the same problem of other people to provide solutions, more importantly, remind themselves, encounter problems, the focus is to solve the problem, do not encounter a problem, find a bunch of related tutorials to chew from scratch, this is certainly not, no doubt, so less than half an hour will give up. Always to solve the current problems as a fundamental purpose, one step, the problem will naturally be solved.
SQL MSG 18054, Level 1