Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 WTF Few days ago it worked now out of range err

Author  Topic 

romeck
Starting Member

16 Posts

Posted - 2014-05-19 : 13:52:59
I create simple VBA module that insert some data to sql through adodb.connection with constring :

Public Const MFConnString As String = "Provider=MSDASQL.1;Extended Properties=DRIVER=SQL Server;SERVER=aaaa\f2;UID=fuser;PWD=Mx3;DATABASE=PRODCOT"

to simplify sql query seem like that:
sql="INSERT INTO [dbo].[MFOSR] ([id],[DocDate] ) Values (1, cast('2014-05-19 19:24:35' as datetime))"

as i execute it through con.execute(sql) i recieve sql error: "[Microsoft]ODBC SQL Server Driber][SQL Server] Varchar conversion to datetime type created value out of range

but as i run it directly through mssql studio management it works perfectly fine. It also has been working just few weeks ago with my VBA module .

what could have happend ?
db collation is Polish_CI_AS , system locale all polish settings.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-19 : 14:11:46
It probably stopped working on May 13th. I suspect the issue is with your application thinking that 05 is the day and 19 is the month. Is there an option to change the dateformat setting?

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

romeck
Starting Member

16 Posts

Posted - 2014-05-19 : 14:41:40
yup :) set datetime format ymd make it work :)

topic to close
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-05-19 : 14:42:50


Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -