Up Prev Next
From: "Ioffe, Dimitry" <Dimitry dot Ioffe at gs dot com>
Subject: RE: datetime values
Date: Jan 29 2003 10:09PM
consider selecting it with convert format 109. It should take care of it:
Jan 29 2003 5:07:26:503PM
Else you'll be just loosing ms part...
From: David Landgren [mailto:firstname.lastname@example.org]
Sent: Wednesday, January 29, 2003 4:57 PM
To: SybPerl Discussion List
Subject: Re: datetime values
Sabherwal, Balvinder (MBS) wrote:
> I am selecting a datetime type column from the database table and
> while I'm losing the second and ms second value from it. Can anyone
> show me how can I preserve the second and ms as well in my select.
> i.e. if I select the value in dbartisan it shows me as "1/29/03
> 3:03:13.847 PM" but if I select and print the same column from the
> perl scrip, it shows me only "1/29/03 3:03PM"
How are you retrieving it? I ran into a similar problem last year and
posted here. I am sort of embarassed to repeat the story, but it was
because I was convert()-ing the datetime into a fixed string. Instead of
using a char(30) I was using a char(27). (Or whatever the length was, I
Because my supplied string was too short, Sybase obligingly truncated it
for me. It just so happened that the truncation occurred at a certain
boundary in the string, which made me think I was losing something in
the conversion. I was, but it was my fault.
> This is important for the script as in the later part, this script
> dose an update to the table which fails as column value is not same as
> the variable value due to the second and ms part missing.
If you are extracting the original datetime via a convert, you should
also do an update by comparing the two converted values.
Hope this helps,