Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Okay, so date formats are the problem. So you mean your application is trying to insert dates something like this:</p> <pre><code>insert into Table1 (DateField1) values ('31/3/2008') </code></pre> <p>which fails because it thinks "31" is the month? Yeah I get that problem too in Australia. Your choices are:</p> <p><strong>1) Change the default language of the database, and the language for existing users.</strong> The language is actually configured on a per-login basis, so for example is SQL Management Studio, Security --> Logins, right-click a login, go to Properties, and change the "Default language" from English to British English. To ensure this also occurs for all new users, you need to change the default language of the server, which is done with:</p> <pre><code>select * from sys.syslanguages </code></pre> <p>.... then find the language you're looking for, i.e. British English and note the <code>langid</code>. To set it, say if British English has langid = 23:</p> <pre><code>sp_configure 'default language', 23 go reconfigure go </code></pre> <p><strong>2) Make your application do date selects/inserts using an appropriate convert i.e.</strong></p> <pre><code>insert into Table1 (DateField) values (convert(datetime, '31/3/2008', 103)) select DateField1 from Table1 where DateField1 = convert(datetime, '31/3/2008, 103)) </code></pre> <p><strong>3) Make your application do date selects/inserts using an international format. From BOL:</strong></p> <blockquote> <p>We recommend that you use date-time formats that are not DATEFORMAT dependent and are multilanguage. The ISO 8601 formats, '1998-02-23T14:23:05' and '1998-02-23T14:23:05-08:00' are the only formats that are an international standard. They are not DATEFORMAT or default login language dependent and are multilanguage.</p> </blockquote> <p>I'm guessing that in this case you can more easily change the database than the application, but if that's not the case then you should really make the application do things in a more global way. App/database design should try to be format-independent where possible.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload