how to convert navarchar to datetime

  • Use this at the beginning of your code:

    SET DATEFORMAT DMY;

    You probably have your server configured incorrectly, using the U.S. defaults.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thanks Luis, that did the trick 🙂

    When you say "You probably have your server configured incorrectly, using the U.S. defaults. ", where is this configuration option?

  • PhilipC (9/23/2016)


    Thanks Luis, that did the trick 🙂

    When you say "You probably have your server configured incorrectly, using the U.S. defaults. ", where is this configuration option?

    In the GUI, you can find it under the Server Properties window in the advanced tab.

    Through code, you can find it in

    SELECT *

    FROM sys.configurations c

    JOIN sys.syslanguages l ON c.value_in_use = l.langid

    WHERE c.name = 'default language';

    And you can change it with this:

    EXEC sys.sp_configure N'default language', N'2' /*Value from sys.syslanguages*/

    GO

    RECONFIGURE WITH OVERRIDE

    GO

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thanks Luis.

Viewing 4 posts - 16 through 18 (of 18 total)

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