Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Time in Timestamps

1 view
Skip to first unread message

Arnie

unread,
Feb 8, 2002, 12:06:59 PM2/8/02
to
We're porting from Oracle 8. It has a datatype of DATE that contains
a full date/time. These columns were converted to TIMESTAMP for DB2.
Try as I might, I can't get a time component inserted. Using DB2
V7.2, ADO->OLEDB(MSDASQL)->IBM ODBC. Client/Server is W2K Pro.
Development environment is Borland C++ Builder 5. Any Ideas?

Alexander Meins

unread,
Feb 8, 2002, 1:02:58 PM2/8/02
to
What's the error message / SQLCODE?

"Arnie" <arn...@earthlink.net> schrieb im Newsbeitrag
news:3c6404c1...@news.earthlink.net...

Bill

unread,
Feb 8, 2002, 5:36:31 PM2/8/02
to
Hi,
In db2, timestamps look like
yyyy-mm-dd-hh.mm.ss.mmmmmm

Where
yyyy = year

mm = month

dd = day

hh = hour

mm = minutes

ss = seconds

mmmmmm = microseconds


What do your 'date/time' values look like ?

Bill

Arnie

unread,
Feb 9, 2002, 8:03:12 AM2/9/02
to
Thanks for the responses.

All this is happening in C++ code using a Borland class called
TDateTime. There is no error when executing the SQL. Selecting it
back with Command Center shows me the date with a 0 time.

troycci

unread,
Feb 10, 2002, 10:33:09 PM2/10/02
to
If you can change the code to use a cast fucntion for TIMESTAMP:
The rules for the arguments depend on whether the second argument is
specified.

a.. If only one argument is specified:
a.. It must be a timestamp, a valid character string representation of a
timestamp, or a character string of length 14 that is neither a CLOB nor a
LONG VARCHAR.
A character string of length 14 must be a string of digits that
represents a valid date and time in the form yyyyxxddhhmmss, where yyyy is
the year, xx is the month, dd is the day, hh is the hour, mm is the minute,
and ss is the seconds.

b.. If both arguments are specified:
a.. The first argument must be a date or a valid character string
representation of a date and the second argument must be a time or a valid
string representation of a time.
The result of the function is a timestamp. If either argument can be null,
the result can be null; if either argument is null, the result is the null
value.

The other rules depend on whether the second argument is specified:

a.. If both arguments are specified:
a.. The result is a timestamp with the date specified by the first
argument and the time specified by the second argument. The microsecond part
of the timestamp is zero.
b.. If only one argument is specified and it is a timestamp:
a.. The result is that timestamp.
c.. If only one argument is specified and it is a character string:
a.. The result is the timestamp represented by that character string. If
the argument is a character string of length 14, the timestamp has a
microsecond part of zero.
Example:

a.. Assume the column START_DATE (date) has a value equivalent to
1988-12-25, and the column START_TIME (time) has a value equivalent to
17.12.30.
TIMESTAMP(START_DATE, START_TIME)

Returns the value '1988-12-25-17.12.30.000000'.

"Arnie" <arn...@earthlink.net> wrote in message
news:3c651d76...@news.earthlink.net...

Dirk "db2scout" Wollscheid

unread,
Feb 11, 2002, 12:15:21 PM2/11/02
to

"Arnie" <arn...@earthlink.net> wrote in message
news:3c651d76...@news.earthlink.net...

Use the CLI trace to see what the CLI functions w/ which values Borland
calls.

Could be a bug in Borland's or DB2 code. Or the TDateTime isn't intended for
TIMESTAMP columns (never used the Borland IDE)

Dirk


Jose R Padilla

unread,
Feb 11, 2002, 2:59:26 PM2/11/02
to
Can any of you guys guide me to find some information regarding DB2
Performance on Linux.

Here it is the scenario:
I have a dual boot (8500R Netfinity) Linux RedHat 7.1 / Windows 2000.
both have: WebSphere 402 and DB2 V7.1 fixpack 5.
The WebSphere throughput is higher on Windows than on Linux (by about 25%)
and we believe it is due to DB2 Performance on Linux.

I am looking for Performance Tunning on Linux that would bust DB to it's
maximum capacity.

Arnie

unread,
Feb 14, 2002, 9:57:37 AM2/14/02
to
Thanks to all for your suggestions.

Actually, I think the problem lies with the MS OLEDB provider for ODBC
(MSDASQL). I tried the insert test using the Borland Database Engine
(BDE) and the time component is inserted correctly.

- Arnie

Greg Nash

unread,
Feb 16, 2002, 3:12:03 PM2/16/02
to
Hi,

There are a few workarounds available via the PATCH1 and PATCH2 keywords
(easiest found using the client config assistant). You can have the DB2
client cast between timestamps, times, and strings.
In terms of inserting a time, try specifying the time from MS tools as a
formatted string rather than a time

--Greg

0 new messages