VB->SQL: Date Format Problem.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: CJM (cjmnews04_at_newsgroups.nospam)
Date: 11/26/04


Date: Fri, 26 Nov 2004 10:09:40 -0000


[Apologies for earlier post - twitchy trigger finger!]

I have a VB6 application that links to an SQL Server 2000 DB (via ADO)

I recently had to change it to add a date field to one of the features,
which although it worked on my development machine, it wouldnt work on the
live system. I normally format my dates for SQL as follows: YYYY-MM-DD, and
this normally works for me. This also worked on my development machine for
this project, but wasnt accepted by the live server. The error generated
was:

Error 3591 - The conversion of a char data type to a datetime data type
resulted in an out-of-range datetime value.

After further investigation, it appears that the SQL code that is called
from the VB app would work fine if run through Query Analyzer on the live
machine.

After a bit of fiddling, I figured out that YYYYMMDD would work on both
servers, so I have a solution.

I imagine that this is something to do with regional settings or
installatioin settings for the different intances of SQL server but beyond
that I am clueless.

Is there anything I can do to remedy this?

Thanks

Chris



Relevant Pages

  • VB->SQL: Date Format Problem.
    ... which although it worked on my development machine, ... but wasnt accepted by the live server. ... it appears that the SQL code that is called ... I imagine that this is something to do with regional settings or ...
    (microsoft.public.vb.database)
  • RE: Rebuild Solution causes MS SQL Server 2005 Install cycle to st
    ... This Solution has a Setup project in it but has no SQL ... Server is that it uses ADO .NET to access data on a SQL Server 2005. ... I'm now on a different development machine and the Build All in Release ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.vsnet.general)
  • Re: Regional & Timezone settings
    ... Is the SQL Server on a different server to the SharePoint installation and ... if so have you checked the time zone of the *server* on which SharePoint is ... running and compared that with the time zone of the server on which SQL ... Regional settings on the SQL server i.e WSS(Site Settings/Site ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Regional & Timezone settings
    ... the SQL Server and Sharepoint server are on ... running and compared that with the time zone of the server on which SQL ... Regional settings on the SQL server i.e WSS(Site Settings/Site ...
    (microsoft.public.sharepoint.windowsservices)
  • RE: Safe to change regional settings in sql server
    ... simply install SQL on a different box using the correct ... In the case of a linked server, however, you cand match your locale (for SQL ... > Is it safe to just simply change the regional settings on the server ...
    (microsoft.public.sqlserver.setup)