Regionaland Language Option settings for SQL Server

  • Dear Friends:

    I have a task on SQL Server 2005 that need to get relative Date format for choosing Language in Regional and Language Option on Control panel.

    Ex : Default Language setting is "English (United States").

    So that SQL Query to Get Date has to show " 2/11/2009".

    Similarly if I select English(United Kingdom) in Regional and Language Option on Control panel.

    then SQL Query to Get Date has to show the Date format as "11/02/2009".

    Can any one help on this regard.

    Thanks

  • If you use ISO format yyyymmdd in your queries then it will work with all language settings.

    Check this out:

    SET LANGUAGE us_english

    SELECT

    ISDATE('20091231'),

    ISDATE('12/31/2009'),

    ISDATE('31/12/2009')

    SET LANGUAGE british

    SELECT

    ISDATE('20091231'),

    ISDATE('12/31/2009'),

    ISDATE('31/12/2009')

    SET LANGUAGE ceština

    SELECT

    ISDATE('20091231'),

    ISDATE('12/31/2009'),

    ISDATE('31/12/2009')

    SET LANGUAGE Svenska

    SELECT

    ISDATE('20091231'),

    ISDATE('12/31/2009'),

    ISDATE('31/12/2009')

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply