Login or Sign Up to become a member!
LessThanDot Site Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

Find logins where the language is different than the default

From Wiki

Jump to: navigation, search

When your logins have a language setting that is different than the default language setting for your server, you can have problems with dates. Date interpretation (month/day/year vs. day/month/year) is controlled by the language of the login that is running the code. There are ways to accommodate dates without requiring that all logins have the same language. Those methods usually require many code changes. Changing the default language for your logins can be a quick short term solution.

To get the default language for SQL Server:

  1. Select  L.Name
  2. From    Master.dbo.sysconfigures C
  3.     Inner Join Master.dbo.syslanguages L
  4.       On C.Value = L.LangId
  5.       And C.Comment = 'default Language'

To get logins that do not have the same language setting as the server:

  1. Declare @DefaultLanguage VarChar(100)
  2. Select  @DefaultLanguage = L.Name
  3. From    Master.dbo.sysconfigures C
  4.         Inner Join Master.dbo.syslanguages L
  5.           On C.Value = L.LangId
  6.           And C.Comment = 'default Language'
  7.  
  8. Select  Name As ProblemItem
  9. From    master..syslogins
  10. Where   Language <> @DefaultLanguage
  11. Order By Name

To change the default language for a login:

  1. SP_DEFAULTLANGUAGE  @loginame = 'LoginName', @LANGUAGE = 'Language'

or

  1. ALTER LOGIN YourLoginName WITH DEFAULT_LANGUAGE=YourLanguage

--George Mastros 17:45, 30 April 2010 (GMT)

767 Rating: 3.2/5 (25 votes cast)