Friday, February 24, 2012

How can I get all the ErrorNumber, ErrorState, ErrorMessage?

How can I get all the ErrorNumber, ErrorState, ErrorMessage?

I want to know all the errornumber, errorstate, errormessage which thrown by sQL Server 2005.

like ErrorNumber 515, ErrorState 2, ErrorMsg "Update failure"

I can't find all the message stored by sql server 2005 in SqlServer2005 book on line.

This will return all error messages in the language of the current connection:

SELECT *

FROM master.sys.messages m

INNER JOIN master.dbo.syslanguages l ON l.msglangid = m.language_id

WHERE l.langid = @.@.LANGID

Chris

|||

Hi Scott,

You might also want to limit it to english language by using the following:

SELECT *

FROM sys.messages

where language_id=1033

Jag

|||

Thank you for your reply.

But how can I get the ErrorState? There is no the field in master.sys.messages.

No comments:

Post a Comment