Unix Technical Forum

Informix 4.10 - CAST Date to Integer

This is a discussion on Informix 4.10 - CAST Date to Integer within the Informix forums, part of the Database Server Software category; --> I'm curious to find out if anyone knows of any issues surrounding a date field returning an error that ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 12:17 PM
jeff
 
Posts: n/a
Default Informix 4.10 - CAST Date to Integer

I'm curious to find out if anyone knows of any issues surrounding a
date field returning an error that it cannot be formatted in the
mm-dd-yyyy format. We tried to cast it to an integer (thinking that
maybe it was still okay as an integer but just won't convert) only to
receive a syntax error

SELECT CAST(date_stamp AS INTEGER) FROM tableName - returns syntax
error

It looks like there are specific records that are corrupt and won't
format into mm-dd-yyyy.

I'm unable to find any support for Informix 4.10 (go figure) and
wondered if anyone here knew offhand some steps I might take to help
get the data or if this is a common enough problem to have a
work-around.

My guess is that I do too much SQL Server and am too ignorant with
informix.

thanks in advance,
J

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 12:17 PM
Jonathan Leffler
 
Posts: n/a
Default Re: Informix 4.10 - CAST Date to Integer


jeff wrote:
> I'm curious to find out if anyone knows of any issues surrounding a
> date field returning an error that it cannot be formatted in the
> mm-dd-yyyy format. We tried to cast it to an integer (thinking that
> maybe it was still okay as an integer but just won't convert) only to
> receive a syntax error
>
> SELECT CAST(date_stamp AS INTEGER) FROM tableName - returns syntax
> error


The cast notation was added to IDS 9 about 8 years ago; it was not
available in Informix 4.10, which was released about 16 years ago (and
was obsolete about 10 years ago).

> It looks like there are specific records that are corrupt and won't
> format into mm-dd-yyyy.


There are specific minimum and maximum values for dates:
enum { DATE_MIN = -693594L }; /* 0001-01-01 */
enum { DATE_MAX = +2958464L }; /* 9999-12-31 */

> I'm unable to find any support for Informix 4.10 (go figure) and
> wondered if anyone here knew offhand some steps I might take to help
> get the data or if this is a common enough problem to have a
> work-around.
>
> My guess is that I do too much SQL Server and am too ignorant with
> informix.


One way to find out whether there are problems is to run an ESQL/C or
equivalent program on the table that simply selects the date values as
stored. You probably can't effectively add conditions on the query -
you might try WHERE datecol NOT BETWEEN MDY(1,1,1) AND MDY(12,31,9999).
The type of the column will be int rather than date; you can simply
print the value - or validate whether it is in range.

You're quite right that no-one will support Informix 4.10; this was
true for quite a while before Y2K.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:44 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com