Re: Datetime overflow with DBI ODBC setting 19th century dates with placeholders

From: Brian McCauley (nobull_at_mail.com)
Date: 05/14/04


Date: 14 May 2004 13:13:50 +0100


"iain" <irhm@clara.net> writes:

> I'm trying to update 19th century dates in SQL Server.
>
> It works fine with dates on or after 1 Jan 1900, but not before. It is also
> OK if the 19th century dates are included as literals in the SQL INSERT or
> UPDATE command (with $dbh->do or prepare/execute)
>
> Error message: DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server
> Driver]Datetime field overflow (SQL-22008)(DBD: st_execute/SQLExecute
> err=-1) at Pat_DOB_error_report.pl line 13.

I've hit this problem too.

> I've tried all kinds of options like bind_param, SQL_DATE, CAST(? as
> datetime). It seems to be interpreted as a date, but the actual year is not
> being processed correctly.
>
> I'm not sure if this is a SQL Server or DBD::ODBC issue. I am using recent
> versions of everything.

I'm not sure either. It could also be in ODBC itself or in the ODBC
driver for MSSQL.

It seems that somewhere along the line all datetime placeholders are
treated as short. One day I'm going to have to investigate.
 
> Any ideas for correction or workaround?

Other than not using placeholders, no.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


Relevant Pages

  • Re: Python 2.3 ODBC Datetime limitations
    ... Has any of you ever used Python odbc to retrieve data from a relational DB? ... The epoch is the point where the time starts. ... So this may not be a problem with the odbc module, which isn't the most up-to-date piece of software on the block but is mostly reliable for simple purposes. ... I'd try something from the datetime module. ...
    (comp.lang.python)
  • How to structure large amounts of data?
    ... Each hit to this table will insert about 20 records. ... I was thinking of splitting it into five or so tables and using a lookup ...
    (microsoft.public.sqlserver.programming)
  • RE: How to create datetime object from DbiDate (win32.odbc)?
    ... > I am using odbc from win32 extensions to connect to MS SQL Server. ... When I select a datetime column from ... odbc returns something called a DbiDate object. ... > datetime type, but I cannot figure out how to convert a DbiDate object ...
    (comp.lang.python)
  • Re: DbiDate object
    ... I am using odbc to connect to Microsoft Access DB. ... I would like to select columns where datetime is> ... and i don't understand how to send request with this DbiDate. ... I convert a DbiDate object to a datetime object like this - ...
    (comp.lang.python)
  • Re: (Excel & ODBC) Howto compare string and datetime????
    ... J> With PostgreSQL I can do it like (dateCol type is timestamp) ... J> Is there possibilities to cast types (from datetime to text) ... J> to another in Excel file ODBC driver??? ...
    (microsoft.public.data.odbc)