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.

date problems

2 posts in General Discussion Last posting was on 2002-08-07 16:58:28.0Z
Chris_B Posted on 2002-08-07 15:25:27.0Z
From: Chris_B
Date: Wed, 7 Aug 2002 11:25:27 -0400
Newsgroups: ianywhere.public.general
Subject: date problems
Message-ID: <BD0181C7D79DA3C30054BA3085256C0E.0054BA4B85256C0E@webforums>
Lines: 23
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:695
Article PK: 2687

I am working on a software project that was origionally written for a DB2
database and therefore all datefields that are written to the database are
written in the format 'mm/dd/yyyy'.

I am trying to convert from DB2 to Sybase SQL Anywhere 8 and am having
problems with the date formats.

I have changed my date_order to MDY and can write a record with a date
('09/15/2002' - format 'mm/dd/yyyy') to the database through the
interactive SQL studio.

However when I attempt this same action through the application (written in
Delphi 4) I get the following error :

"General SQL error
[Sybase][ODBC Driver][Adaptive Server Anywhere]Restricted data type
attribute violation Cannot convert 8/7/2002 to a timestamp"

This operation is successful through the application however when I change
the date to the format 'yyyy/mm/dd'.

Is there an option that I can change or check for the database that will
allow this operation?


Jason Hinsperger Posted on 2002-08-07 16:58:28.0Z
From: "Jason Hinsperger" <jason_hinsperger@NOSPAMhotmail.com>
References: <BD0181C7D79DA3C30054BA3085256C0E.0054BA4B85256C0E@webforums>
Subject: Re: date problems
Date: Wed, 7 Aug 2002 12:58:28 -0400
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <PumDkVjPCHA.197@forums.sybase.com>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: 172.31.141.17
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub ianywhere.public.general:694
Article PK: 3205

ODBC resets the date order to its default whenever you connect.
You must set the date_order option every time you connect for it to be
effective through ODBC.
eg.
SQLConnect(...)
SQLAllocStmt(...)
SQLExecDirect( hstmt, "Set option date_order='MDY'" )

--
Jason Hinsperger
International and Sustaining Engineering
iAnywhere Solutions

<Chris_B> wrote in message
news:BD0181C7D79DA3C30054BA3085256C0E.0054BA4B85256C0E@webforums...
> I am working on a software project that was origionally written for a DB2
> database and therefore all datefields that are written to the database are
> written in the format 'mm/dd/yyyy'.
>
> I am trying to convert from DB2 to Sybase SQL Anywhere 8 and am having
> problems with the date formats.
>
> I have changed my date_order to MDY and can write a record with a date
> ('09/15/2002' - format 'mm/dd/yyyy') to the database through the
> interactive SQL studio.
>
> However when I attempt this same action through the application (written
in
> Delphi 4) I get the following error :
>
> "General SQL error
> [Sybase][ODBC Driver][Adaptive Server Anywhere]Restricted data type
> attribute violation Cannot convert 8/7/2002 to a timestamp"
>
> This operation is successful through the application however when I change
> the date to the format 'yyyy/mm/dd'.
>
> Is there an option that I can change or check for the database that will
> allow this operation?