Thursday 30 October 2008

SQL Server Language Settings

This is to solve the problem where we want to be using British English in SQL but it insists in using US English.


   1:  PRINT @@LANGUAGE

Will show you current default server language (should be British).


   1:  sp_defaultlanguage 'your-domain\your-username'

will make your username take on the default of the server. (of course replace username with the one you want to change). If the logins are done via groups and not individual users, you will need to change the group's default language (by using the group instead of the specific user as parameter to sp_defaultlanguage).

also read for more information:

sp_defaultlanguage doc:
http://doc.ddart.net/mssql/sql70/sp_da-di_7.htm

default language options:
http://msdn.microsoft.com/en-us/library/aa196707(SQL.80).aspx

sp_configure doc:
http://msdn.microsoft.com/en-us/library/aa259616(SQL.80).aspx

If all fails you can use SET DATEFORMAT eg


   1:  SET DATEFORMAT dmy

for European, inside the stored procedure you are executing, but I prefer the first solution based on user settings. On the other hand the SET DATEFORMAT command in the stored procedure makes it more robust, its up to you.

Failing all can use:


   1:  ALTER LOGIN user1 WITH DEFAULT_LANGUAGE = British

No comments: