Using SQL Server 2000
I am trying to get the error description that you get in Query Analyzer or in a web page connection - only directly in a stored procedure in MS SQL.
Basically this message:
Server: Msg 2627, Level 14, State 1, Line 1
Violation of PRIMARY KEY constraint 'UPKCL_pubind'. Cannot insert duplicate key in object 'publishers'.
The statement has been terminated.
A very detailed example of what I am looking for is here: http:Q_20336836.html
It even shows examples of what is being looked for and what the template in master.dbo.sysmessages looks like.
However, the solution there was to get the information through the web server/programming code - not directly within a stored procedure.
I also looked at the link here:
which was an article recommended here : http:Q_20891906.html
as a way to get the output buffer, but it is not clean like the above message and I need the clean message.
It seems strange to me that SQL Query Analyzer can get this error information.
Programming languages have this information passed as a database exception/error message (depending on the language), but that the error cannot be accessed in SQL itself.
Any ideas on how this can be done?