|
Hi Brian,
try to use DIGITS instead of CHAR and add the leading zero:
Select *
From SST30
Where SPPLCD = 2
And DIGITS(SPCRDT) concat DIGITS(SPCRTM)
Between '200511030600' and '200511040200'
Birgitta
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Brian Piotrowski
Gesendet: Donnerstag, 10. November 2005 16:16
An: Midrange Systems Technical Discussion
Betreff: RE: Select Results in a DB2 statement
Thanks Richard.
The only problem is that the field is a 4S 0, so when the time less than
10:00am, it will only display those characters not equal to 0. So when
I look at the table, 12:03am is really 3, 2:55am is really 255, etc.
Brian.
-----Original Message-----
From: Richard ECUYER [mailto:recuyer@xxxxxxx]
Sent: Thursday, November 10, 2005 10:04 AM
To: Midrange Systems Technical Discussion
Subject: Re: Select Results in a DB2 statement
perhaps :
select * from SST30 where spplcd ='2' and
concat(char(spcrdt),char(spcrtm)) >='200511030600' and
concat(char(spcrdt),char(spcrtm)) <='200511040200'
order by spcrdt, spcrtm
----- Original Message -----
From: "Brian Piotrowski" <bpiotrowski@xxxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Thursday, November 10, 2005 3:53 PM
Subject: Select Results in a DB2 statement
Hi All,
I have an SQL statement that has this:
select * from SST30 where spplcd ='2' and
concat(char(spcrdt),char(spcrtm)) >='20051103600' and
concat(char(spcrdt),char(spcrtm)) <='20051104200'
order by spcrdt, spcrtm
When I run the statement, I get a list of records between 2005/11/04
7:43 am and 2005/11/05 19:04pm. However, the records I am expecting it
to return should be between 2005/11/03 6:00am and 2005/11/04 2:00am.
I did check our DB2 table, and there indeed records in there from
2005/11/03 6:56am and 2005/11/03 22:23pm. Why doesn't this statement
pick up these records? Does it have something to do with using the
concat command and converting the values to characters? If so, is there
a better way to handle this conversion?
Thanks!
Brian.
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Brian Piotrowski
Specialist - I.T.
Simcoe Parts Service, Inc.
PH: 705-435-7814
FX: 705-435-6746
-=-=-=-=-=-=-=-=-=-=-=-=-=-
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.