FW: Re: Part 1 of several - Converting a varchar to an interval

From: aklaver(at)comcast(dot)net (Adrian Klaver)
To: pgsql-sql(at)postgresql(dot)org
Subject: FW: Re: Part 1 of several - Converting a varchar to an interval
Date: 2008-03-26 16:32:34
Message-ID: 032620081632.25756.47EA7AA200070FAB0000649C22007374789D0A900E04050E@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


-------------- Forwarded Message: --------------
From: aklaver(at)comcast(dot)net (Adrian Klaver)
To: Shawn <postgres(at)xmtservices(dot)net>
Subject: Re: [SQL] Part 1 of several - Converting a varchar to an interval
Date: Wed, 26 Mar 2008 16:16:58 +0000
>
>
>
>
> -------------- Original message ----------------------
> From: Shawn <postgres(at)xmtservices(dot)net>
> > Hello,
> >
> > I have several large tables, over 100 million records each. One of the fields
> > is callee 'duration'. It is a varchar that contains what is essentially an
> > integer that is the duration of an event in milleseconds. Could someone tell
> > me a simple way to convert a value such as 134987 stored in a varchar into an
> > interval?
> >
> > This will dovetail with my next question.
> >
> > Thanks for all the help both now and previous.
> >
> > Shawn
> >
>
select ('134987'::int/1000.00) * interval ' 1 second' ;
?column?
--------------
00:02:14.987
(1 row)

Forgot to Reply All.
--
Adrian Klaver
aklaver(at)comcast(dot)net

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Adrian Klaver 2008-03-26 16:33:42 FW: Re: Question 2 Interval and timestamptz
Previous Message Shawn 2008-03-26 16:27:25 Re: Part 1 of several - Converting a varchar to an interval