Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

varchar to datetime conversion

3 posts in JConnect version 3.0 Last posting was on 1999-03-12 17:31:11.0Z
Shalabh Goel Posted on 1999-03-11 20:39:59.0Z
Message-ID: <36E82A1F.58FB6CF@gdis.com>
Date: Thu, 11 Mar 1999 12:39:59 -0800
From: Shalabh Goel <sgoel@gdis.com>
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: varchar to datetime conversion
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jconnect30
Lines: 29
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jconnect30:300
Article PK: 255714

I am getting the following error message when trying to insert a record
in Sybase database:

com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit
conversion
of VARCHAR value '07101998 08:00 AM' to a DATETIME field .

at com.sybase.tds.Tds.processEed(Compiled Code)
at com.sybase.tds.Tds.nextResult(Compiled Code)
at com.sybase.jdbc.ResultGetter.nextResult(ResultGetter.java)
at com.sybase.jdbc.SybStatement.nextResult(Compiled Code)
at com.sybase.jdbc.SybStatement.updateLoop(Compiled Code)
at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)

at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)

at FacilityUpdate.writeToDB(FacilityUpdate.java:117)
at FacilityUpdate.<init>(FacilityUpdate.java:27)
at CheckOrderClient.run(Compiled Code)
at CheckOrderClient.CheckOrderClient(CheckOrderClient.java:25)
at CheckOrderMain.main(Compiled Code)

The syntax is similar to:
Insert into Table (datetimeColumn) values ('07101998 08:00 AM')

Can u help please?
Thanks

Shalabh


Kevin J. Grittner Posted on 1999-03-12 17:31:11.0Z
Message-ID: <36E94F5F.DA77710C@chorus.net>
Date: Fri, 12 Mar 1999 11:31:11 -0600
From: "Kevin J. Grittner" <kjgrittn@chorus.net>
X-Mailer: Mozilla 4.5 [en] (WinNT; I)
X-Accept-Language: en-US,en,en-GB
MIME-Version: 1.0
Subject: Re: varchar to datetime conversion
References: <36E82A1F.58FB6CF@gdis.com>
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Newsgroups: sybase.public.jconnect30
Lines: 51
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jconnect30:298
Article PK: 254600

Perhaps this will be useful -- from the JDBC spec:

11.3 Time and Date Literals

DBMSs differ in the syntax they use for date, time, and timestamp
literals. JDBC supports ISO
standard format for the syntax of these literals, using an escape clause
that the driver must
translate to the DBMS representation.

For example, a date is specified in a JDBC SQL statement with the syntax

{d ‘yyyy-mm-dd’}

where yyyy-mm-dd provides the year, month, and date, e.g. 1996-02-28.
The driver will replace
this escape clause with the equivalent DBMS-specific representation,
e.g. ‘Feb 28, 1996’
for Oracle.

There are analogous escape clauses for TIME and TIMESTAMP:

{t ‘hh:mm:ss’}

{ts ‘yyyy-mm-dd hh:mm:ss.f...’}

The fractional seconds (.f...) portion of the TIMESTAMP can be omitted.

Shalabh Goel wrote:
>
> I am getting the following error message when trying to insert a record
> in Sybase database:
>
> com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit
> conversion
> of VARCHAR value '07101998 08:00 AM' to a DATETIME field .
>
> at com.sybase.tds.Tds.processEed(Compiled Code)
> at com.sybase.tds.Tds.nextResult(Compiled Code)
> at com.sybase.jdbc.ResultGetter.nextResult(ResultGetter.java)
> at com.sybase.jdbc.SybStatement.nextResult(Compiled Code)
> at com.sybase.jdbc.SybStatement.updateLoop(Compiled Code)
> at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)
>
> at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)
>
> at FacilityUpdate.writeToDB(FacilityUpdate.java:117)
> at FacilityUpdate.<init>(FacilityUpdate.java:27)
> at CheckOrderClient.run(Compiled Code)
> at CheckOrderClient.CheckOrderClient(CheckOrderClient.java:25)
> at CheckOrderMain.main(Compiled Code)
>
> The syntax is similar to:
> Insert into Table (datetimeColumn) values ('07101998 08:00 AM')
>
> Can u help please?
> Thanks
>
> Shalabh


Lance Andersen Posted on 1999-03-12 12:42:59.0Z
Message-ID: <36E90BD3.1824DF6C@sybase.com>
Date: Fri, 12 Mar 1999 07:42:59 -0500
From: Lance Andersen <lancea@sybase.com>
X-Mailer: Mozilla 4.5 [en] (X11; U; SunOS 5.5.1 sun4m)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: varchar to datetime conversion
References: <36E82A1F.58FB6CF@gdis.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jconnect30
Lines: 46
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jconnect30:299
Article PK: 254601


Shalabh Goel wrote:
>
> I am getting the following error message when trying to insert a record
> in Sybase database:
>
> com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit
> conversion
> of VARCHAR value '07101998 08:00 AM' to a DATETIME field .
>
> at com.sybase.tds.Tds.processEed(Compiled Code)
> at com.sybase.tds.Tds.nextResult(Compiled Code)
> at com.sybase.jdbc.ResultGetter.nextResult(ResultGetter.java)
> at com.sybase.jdbc.SybStatement.nextResult(Compiled Code)
> at com.sybase.jdbc.SybStatement.updateLoop(Compiled Code)
> at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)
>
> at com.sybase.jdbc.SybStatement.executeUpdate(SybStatement.java)
>
> at FacilityUpdate.writeToDB(FacilityUpdate.java:117)
> at FacilityUpdate.<init>(FacilityUpdate.java:27)
> at CheckOrderClient.run(Compiled Code)
> at CheckOrderClient.CheckOrderClient(CheckOrderClient.java:25)
> at CheckOrderMain.main(Compiled Code)
>
> The syntax is similar to:
> Insert into Table (datetimeColumn) values ('07101998 08:00 AM')
>
> Can u help please?
> Thanks
>
> Shalabh

Try the same insert statement via dblib/ctlib flavors of isql and you
should encounter the same error. So you need to chase this via the SQL
Server not jConnect.

lance
team sybase
--
===============================================================================
Lance J. Andersen Email: lancea@sybase.com
Sybase Product Support Engineering Phone:(781) 564-6336
77 South Bedford Street Fax: (781) 564-6148
Burlington, MA 01803

The Dark Knight Returns!!! Let's Go Penguins!!!
===============================================================================