Recently, we faced strange issue wherein one of our customers was capturing error messages coming from SQL server and writing them into database table. These error messages could not help much to customer as error messages were in Spanish language.
As a part of our primary investigation, we verified the default language of database which was set to English. Hence, we suspected the code that was writing errors to database table. However, our customer was too sure about his stored code. Finally, after several hours of our exercise, we could resolve the problem and came to know following:
- Customer was right on his place; his code was never in question.
- In our primary investigation, we verified default language of database but missed the configuration of database user default language.
- We modified the database user configuration and changed its default language to English.
Let’s see how we did it:
Configure default language option for database user from SQL Server Management Studio 2012
- In Object Explorer, right-click on server and select Properties.
- Click the Misc server settings node.
- In the Default language for users box, choose the language in which Microsoft SQL Server should display system messages.
- The default language is English.
Configure default language option for database user from Using Transact-SQL
- Connect to the Database Engine.
- From the Standard bar, click New Query.
- Copy and paste the following example into the query window and click Execute.
- The setting takes effect immediately without restarting the server.
EXEC sp_defaultlanguage 'user_name', 'us_english' GO