开发者

How can I get the message for a @@Error number?

开发者 https://www.devze.com 2023-01-15 10:06 出处:网络
You would think it would be easy to find out what 1 me开发者_运维问答ans, but google is not being helpful (I would guess that it does not see the @@ part and error is to generic.

You would think it would be easy to find out what 1 me开发者_运维问答ans, but google is not being helpful (I would guess that it does not see the @@ part and error is to generic.

MSDN (at least on the @@Error page and Concept page) is also unhelpful.

Any help here?


You need to inspect the sys.messages system catalog view:

SELECT * 
FROM sys.messages
WHERE message_id = @YourErrorCode AND language_id = 1033

The message_id should be the error code you get, and you also need to specify the language you want your message in, 1033 being English.

You can find out more about your languages from:

SELECT * FROM sys.syslanguages WHERE lcid = 1033

Those LCID are pretty much standard - you can find all SQL Server defined languages in that system catalog view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号