Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display error messages in different languages by sql server

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains how sql server uses different languages to display error messages, the content is clear, interested friends can learn, I believe it will be helpful after reading.

Question:

The operating system and database of the production environment may be in English, but our mother tongue is Chinese. if we have a poor command of English, we may sometimes fail to understand the wrong English prompt of the database in the English environment. if you directly use English error prompts to be translated through translation tools, it is not necessarily 100% accurate.

Solution:

Specify a language through set language, so that the error report of sql server is presented in that language.

Script:

/ * description: specify a language through set language Make sql server's error report present the script in that language Source: https://www.cnblogs.com/zhang502219048/p/12826544.html reference: https://docs.microsoft.com/zh-cn/sql/t-sql/statements/set-language-transact-sql?view=sql-server-2017 reference Table: select * from sys.syslanguages*/--Divide by zero error encountered.set language US_ENGLISHbegin try declare @ I int = 1 / 0end trybegin catch select ERROR_MESSAGE () As ErrorInfoend catchgo-- encountered a zero divisor error. Set language simplified Chinese begin try declare @ I int = 1 / 0end trybegin catch select ERROR_MESSAGE () as ErrorInfoend catchgo-- found an error divided by zero. Begin try declare @ I int = 1 / 0end trybegin catch select ERROR_MESSAGE () as ErrorInfoend catchgo--0 in set language traditional Chinese is divided into two categories. Set language Japan / begin try declare @ I int = 1 / 0end trybegin catch select ERROR_MESSAGE () as ErrorInfoend catchgo--0 / 0end trybegin catch select ERROR_MESSAGE / as ErrorInfoend catchgo / Japan / 0end trybegin catch select ERROR_MESSAGE / as ErrorInfoend catchgo / Japan / I int = 1 / 0end trybegin catch select ERROR_MESSAGE () as ErrorInfoend catchgo

The result of running the script (take English, Chinese (simplified, traditional), Japanese, Korean (Korean) as examples):

After reading the above, do you have a better understanding of how sql server uses different languages to display error messages? if you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report