Re: DATETIME --> INTEGER
Posted in 1994
(Posted to the Net since it is of relative interest). > > In order to track call lengths for billing purposes, > my company needs to export a column from the call- > tracking database to the billing database. The call- > tracking column is in a DATETIME MINUTE to SECOND > format while the receiving column requires an INTEGER. > Essentially, I must find a way to turn 3:30 into 3.5. > Everything I have tried (views, duration, etc.) hasn't > worked. Does anybody have a suggestion short of > changing the DATETIME format in the original table > to an INTEGER? > > Thank you, > Ken Norton > -- > KENNETH S. NORTON +================================+ > Upgrade Corp of America | My opinions are barely my own, | > 74437.1160@compuserve.com | and hardly my employer's. | > aq069@freenet.buffalo.edu +================================+ > I have not gone through your situation exhaustively. But, I posted something about a week ago on DATETIME INTERVAL which hinted at a solution. You can restrict the information you extract from a datetime: TABLE a (COL1 DATETIME MINUTE TO SECOND) DECLARE x CURSOR FOR SELECT EXTEND(COL1, MINUTE TO MINUTE), EXTEND(COL1, SECOND TO SECOND) FROM a Then you just read divide the seconds by 60 AFTER YOU HAVE READ THEM - SQL cannot handle the implied data conversion inline. DEFINE min SMALLINT, sec FLOAT FOREACH x INTO min, sec LET sec = sec / 60 # do whatever END FOREACH cheers j. _____________________________________________________________________________ Jack Parker | Hewlett Packard, BSMC Boise, Idaho, USA| He who talks most, talks least. jparker@hpbs3645.boi.hp.com | _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________