pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDatatype conversion help
13+ messages / 7 participants
[nested] [flat]
* Datatype conversion help
@ 2003-07-08 20:07 Yasir Malik <ymalik@cs.stevens-tech.edu>
0 siblings, 2 replies; 13+ messages in thread
From: Yasir Malik @ 2003-07-08 20:07 UTC (permalink / raw)
To: pgsql-sql
Suppose I have an integer between 0 and 99 and I want to covert it to
string, and pad leading zeros if neccessary. For example,
1 => 01
10 => 10
I've tried to_char(in_val, '99'), and that returns a string that is two
charecters, but there isn't a leading zero incase I have the number 2 as
input. Any ideas? Thanks.
Yasir
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-08 20:26 Michael A Nachbaur <mike@nachbaur.com>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
1 sibling, 0 replies; 13+ messages in thread
From: Michael A Nachbaur @ 2003-07-08 20:26 UTC (permalink / raw)
To: Yasir Malik <ymalik@cs.stevens-tech.edu>; pgsql-sql
You want to use:
nachbaur=# select to_char(5, '00');
to_char
---------
05
(1 row)
By using "0", you indicate you want leading zeros. See
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-formatting.html
for more information.
On Tuesday 08 July 2003 01:07 pm, Yasir Malik wrote:
> Suppose I have an integer between 0 and 99 and I want to covert it to
> string, and pad leading zeros if neccessary. For example,
> 1 => 01
> 10 => 10
>
> I've tried to_char(in_val, '99'), and that returns a string that is two
> charecters, but there isn't a leading zero incase I have the number 2 as
> input. Any ideas? Thanks.
> Yasir
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
--
/* Michael A. Nachbaur <mike@nachbaur.com>
* http://nachbaur.com/pgpkey.asc
*/
"Oh no, not again."
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-08 20:28 Yasir Malik <ymalik@cs.stevens-tech.edu>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
1 sibling, 2 replies; 13+ messages in thread
From: Yasir Malik @ 2003-07-08 20:28 UTC (permalink / raw)
To: pgsql-sql
Thank you so much! But my problem is that when I do
to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
'9999')
where mn, dy, and yr are ints, is that the output has a space after the
the dash. For example, I get
07- 25- 1994
instead of what I want:
07-25-1994
Thanks,
Yasir
On Tue, 8 Jul 2003, Richard Rowell wrote:
> Date: 08 Jul 2003 15:21:33 -0500
> From: Richard Rowell <richard@bowmansystems.com>
> To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> Subject: Re: [SQL] Datatype conversion help
>
> On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> > I've tried to_char(in_val, '99'), and that returns a string that is two
>
> select to_char(9,'00');
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-08 20:45 Michael A Nachbaur <mike@nachbaur.com>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
1 sibling, 0 replies; 13+ messages in thread
From: Michael A Nachbaur @ 2003-07-08 20:45 UTC (permalink / raw)
To: Yasir Malik <ymalik@cs.stevens-tech.edu>; pgsql-sql
http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-formatting.html#FU...
See the pattern modifier "FM". From the docs:
"FM prefix - fill mode (suppress padding blanks and zeroes)"
On Tuesday 08 July 2003 01:28 pm, Yasir Malik wrote:
> Thank you so much! But my problem is that when I do
> to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
> '9999')
>
> where mn, dy, and yr are ints, is that the output has a space after the
> the dash. For example, I get
> 07- 25- 1994
>
> instead of what I want:
> 07-25-1994
>
> Thanks,
> Yasir
>
> On Tue, 8 Jul 2003, Richard Rowell wrote:
> > Date: 08 Jul 2003 15:21:33 -0500
> > From: Richard Rowell <richard@bowmansystems.com>
> > To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> > Subject: Re: [SQL] Datatype conversion help
> >
> > On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> > > I've tried to_char(in_val, '99'), and that returns a string that is two
> >
> > select to_char(9,'00');
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
--
/* Michael A. Nachbaur <mike@nachbaur.com>
* http://nachbaur.com/pgpkey.asc
*/
"He expanded his chest to make it totally clear that here
was the sort of man you only dared to cross if you had a
team of Sherpas with you. "
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-08 21:02 David Olbersen <DOlbersen@stbernard.com>
0 siblings, 1 reply; 13+ messages in thread
From: David Olbersen @ 2003-07-08 21:02 UTC (permalink / raw)
To: pgsql-sql
Yasir,
If this is a date you're playing with, simply use:
to_char( <whatever date>, 'MM-DD-YYYY' )
to get what you want.
--------------------------
David Olbersen
iGuard Engineer
St. Bernard Software
11415 West Bernardo Court
San Diego, CA 92127
1-858-676-2277 x2152
> -----Original Message-----
> From: Yasir Malik [mailto:ymalik@cs.stevens-tech.edu]
> Sent: Tuesday, July 08, 2003 1:29 PM
> To: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Datatype conversion help
>
>
> Thank you so much! But my problem is that when I do
> to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
> '9999')
>
> where mn, dy, and yr are ints, is that the output has a space
> after the
> the dash. For example, I get
> 07- 25- 1994
>
> instead of what I want:
> 07-25-1994
>
> Thanks,
> Yasir
>
> On Tue, 8 Jul 2003, Richard Rowell wrote:
>
> > Date: 08 Jul 2003 15:21:33 -0500
> > From: Richard Rowell <richard@bowmansystems.com>
> > To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> > Subject: Re: [SQL] Datatype conversion help
> >
> > On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> > > I've tried to_char(in_val, '99'), and that returns a
> string that is two
> >
> > select to_char(9,'00');
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-08 21:19 Yasir Malik <ymalik@cs.stevens-tech.edu>
parent: David Olbersen <DOlbersen@stbernard.com>
0 siblings, 1 reply; 13+ messages in thread
From: Yasir Malik @ 2003-07-08 21:19 UTC (permalink / raw)
To: David Olbersen <DOlbersen@stbernard.com>; +Cc: pgsql-sql
Yes, Mr. Nachbaur helped me out. Thanks. I don't think I can do
to_char(<whatever date>, 'MM-DD-YYYY)
because the date fields are originally stored as separate integers in my
schema (they have to be that way). I still can't understand why the extra
space was added after the dash. It just made my life more miserable.
Yasir
On Tue, 8 Jul 2003, David Olbersen
wrote:
> Date: Tue, 8 Jul 2003 14:02:55 -0700
> From: David Olbersen <DOlbersen@stbernard.com>
> To: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Datatype conversion help
>
> Yasir,
>
> If this is a date you're playing with, simply use:
>
> to_char( <whatever date>, 'MM-DD-YYYY' )
>
> to get what you want.
>
> --------------------------
> David Olbersen
> iGuard Engineer
> St. Bernard Software
> 11415 West Bernardo Court
> San Diego, CA 92127
> 1-858-676-2277 x2152
>
>
> > -----Original Message-----
> > From: Yasir Malik [mailto:ymalik@cs.stevens-tech.edu]
> > Sent: Tuesday, July 08, 2003 1:29 PM
> > To: pgsql-sql@postgresql.org
> > Subject: Re: [SQL] Datatype conversion help
> >
> >
> > Thank you so much! But my problem is that when I do
> > to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
> > '9999')
> >
> > where mn, dy, and yr are ints, is that the output has a space
> > after the
> > the dash. For example, I get
> > 07- 25- 1994
> >
> > instead of what I want:
> > 07-25-1994
> >
> > Thanks,
> > Yasir
> >
> > On Tue, 8 Jul 2003, Richard Rowell wrote:
> >
> > > Date: 08 Jul 2003 15:21:33 -0500
> > > From: Richard Rowell <richard@bowmansystems.com>
> > > To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> > > Subject: Re: [SQL] Datatype conversion help
> > >
> > > On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> > > > I've tried to_char(in_val, '99'), and that returns a
> > string that is two
> > >
> > > select to_char(9,'00');
> > >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 8: explain analyze is your friend
> >
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-09 08:29 Richard Huxton <dev@archonet.com>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
0 siblings, 0 replies; 13+ messages in thread
From: Richard Huxton @ 2003-07-09 08:29 UTC (permalink / raw)
To: Yasir Malik <ymalik@cs.stevens-tech.edu>; David Olbersen <DOlbersen@stbernard.com>; +Cc: pgsql-sql
On Tuesday 08 Jul 2003 10:19 pm, Yasir Malik wrote:
> Yes, Mr. Nachbaur helped me out. Thanks. I don't think I can do
> to_char(<whatever date>, 'MM-DD-YYYY)
> because the date fields are originally stored as separate integers in my
> schema (they have to be that way). I still can't understand why the extra
> space was added after the dash. It just made my life more miserable.
> Yasir
You are not the only one it makes miserable. I believe it's there to provide
compatibility with Oracle/some other db. Their function does it so ours
should too. Very strange behaviour though.
--
Richard Huxton
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-09 18:49 Yasir Malik <ymalik@cs.stevens-tech.edu>
parent: Dmitry Tkach <dmitry@openratings.com>
0 siblings, 1 reply; 13+ messages in thread
From: Yasir Malik @ 2003-07-09 18:49 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: pgsql-sql
I used trim and here's what I came up with:
to_date(trim(to_char(yr, '9999') || trim(to_char(mn, '00')) ||
trim(to_char(dy, '00'))), 'YYYYMMDD')
Apparently to_char adds a space to the charecter you are casting.
Yasir
On Wed, 9 Jul 2003, Dmitry Tkach wrote:
> Date: Wed, 09 Jul 2003 18:40:37 -0400
> From: Dmitry Tkach <dmitry@openratings.com>
> To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Datatype conversion help
>
> What about lpad?
>
> select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003';
> ?column?
> ------------
> 07-09-2003
> (1 row)
>
>
> I hope, it helps...
>
> Dima
>
> Yasir Malik wrote:
>
> >Thank you so much! But my problem is that when I do
> >to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
> >'9999')
> >
> >where mn, dy, and yr are ints, is that the output has a space after the
> >the dash. For example, I get
> >07- 25- 1994
> >
> >instead of what I want:
> >07-25-1994
> >
> >Thanks,
> >Yasir
> >
> >On Tue, 8 Jul 2003, Richard Rowell wrote:
> >
> >
> >
> >>Date: 08 Jul 2003 15:21:33 -0500
> >>From: Richard Rowell <richard@bowmansystems.com>
> >>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> >>Subject: Re: [SQL] Datatype conversion help
> >>
> >>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> >>
> >>
> >>>I've tried to_char(in_val, '99'), and that returns a string that is two
> >>>
> >>>
> >>select to_char(9,'00');
> >>
> >>
> >>
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 8: explain analyze is your friend
> >
> >
>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-09 18:55 Yasir Malik <ymalik@cs.stevens-tech.edu>
parent: Dmitry Tkach <dmitry@openratings.com>
1 sibling, 0 replies; 13+ messages in thread
From: Yasir Malik @ 2003-07-09 18:55 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; +Cc: pgsql-sql
I will surely use your suggestion in my future programs.
Thanks,
Yasir
On Wed, 9 Jul 2003, Dmitry Tkach wrote:
> Date: Wed, 09 Jul 2003 18:51:48 -0400
> From: Dmitry Tkach <dmitry@openratings.com>
> To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Datatype conversion help
>
> Yasir Malik wrote:
>
> >I used trim and here's what I came up with:
> >to_date(trim(to_char(yr, '9999') || trim(to_char(mn, '00')) ||
> >trim(to_char(dy, '00'))), 'YYYYMMDD')
> >
> >Apparently to_char adds a space to the charecter you are casting.
> >
> >
> I know :-)
> And lpad doesn't - that's why I suggested it :-)
>
> Dima
>
> >
> >On Wed, 9 Jul 2003, Dmitry Tkach wrote:
> >
> >
> >
> >>Date: Wed, 09 Jul 2003 18:40:37 -0400
> >>From: Dmitry Tkach <dmitry@openratings.com>
> >>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> >>Cc: pgsql-sql@postgresql.org
> >>Subject: Re: [SQL] Datatype conversion help
> >>
> >>What about lpad?
> >>
> >>select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003';
> >> ?column?
> >>------------
> >> 07-09-2003
> >>(1 row)
> >>
> >>
> >>I hope, it helps...
> >>
> >>Dima
> >>
> >>Yasir Malik wrote:
> >>
> >>
> >>
> >>>Thank you so much! But my problem is that when I do
> >>>to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
> >>>'9999')
> >>>
> >>>where mn, dy, and yr are ints, is that the output has a space after the
> >>>the dash. For example, I get
> >>>07- 25- 1994
> >>>
> >>>instead of what I want:
> >>>07-25-1994
> >>>
> >>>Thanks,
> >>>Yasir
> >>>
> >>>On Tue, 8 Jul 2003, Richard Rowell wrote:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Date: 08 Jul 2003 15:21:33 -0500
> >>>>From: Richard Rowell <richard@bowmansystems.com>
> >>>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
> >>>>Subject: Re: [SQL] Datatype conversion help
> >>>>
> >>>>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>I've tried to_char(in_val, '99'), and that returns a string that is two
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>select to_char(9,'00');
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>---------------------------(end of broadcast)---------------------------
> >>>TIP 8: explain analyze is your friend
> >>>
> >>>
> >>>
> >>>
> >>
> >>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-09 22:40 Dmitry Tkach <dmitry@openratings.com>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
1 sibling, 1 reply; 13+ messages in thread
From: Dmitry Tkach @ 2003-07-09 22:40 UTC (permalink / raw)
To: Yasir Malik <ymalik@cs.stevens-tech.edu>; +Cc: pgsql-sql
What about lpad?
select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003';
?column?
------------
07-09-2003
(1 row)
I hope, it helps...
Dima
Yasir Malik wrote:
>Thank you so much! But my problem is that when I do
>to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
>'9999')
>
>where mn, dy, and yr are ints, is that the output has a space after the
>the dash. For example, I get
>07- 25- 1994
>
>instead of what I want:
>07-25-1994
>
>Thanks,
>Yasir
>
>On Tue, 8 Jul 2003, Richard Rowell wrote:
>
>
>
>>Date: 08 Jul 2003 15:21:33 -0500
>>From: Richard Rowell <richard@bowmansystems.com>
>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
>>Subject: Re: [SQL] Datatype conversion help
>>
>>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
>>
>>
>>>I've tried to_char(in_val, '99'), and that returns a string that is two
>>>
>>>
>>select to_char(9,'00');
>>
>>
>>
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-09 22:51 Dmitry Tkach <dmitry@openratings.com>
parent: Yasir Malik <ymalik@cs.stevens-tech.edu>
0 siblings, 2 replies; 13+ messages in thread
From: Dmitry Tkach @ 2003-07-09 22:51 UTC (permalink / raw)
To: Yasir Malik <ymalik@cs.stevens-tech.edu>; +Cc: pgsql-sql
Yasir Malik wrote:
>I used trim and here's what I came up with:
>to_date(trim(to_char(yr, '9999') || trim(to_char(mn, '00')) ||
>trim(to_char(dy, '00'))), 'YYYYMMDD')
>
>Apparently to_char adds a space to the charecter you are casting.
>
>
I know :-)
And lpad doesn't - that's why I suggested it :-)
Dima
>
>On Wed, 9 Jul 2003, Dmitry Tkach wrote:
>
>
>
>>Date: Wed, 09 Jul 2003 18:40:37 -0400
>>From: Dmitry Tkach <dmitry@openratings.com>
>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
>>Cc: pgsql-sql@postgresql.org
>>Subject: Re: [SQL] Datatype conversion help
>>
>>What about lpad?
>>
>>select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003';
>> ?column?
>>------------
>> 07-09-2003
>>(1 row)
>>
>>
>>I hope, it helps...
>>
>>Dima
>>
>>Yasir Malik wrote:
>>
>>
>>
>>>Thank you so much! But my problem is that when I do
>>>to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
>>>'9999')
>>>
>>>where mn, dy, and yr are ints, is that the output has a space after the
>>>the dash. For example, I get
>>>07- 25- 1994
>>>
>>>instead of what I want:
>>>07-25-1994
>>>
>>>Thanks,
>>>Yasir
>>>
>>>On Tue, 8 Jul 2003, Richard Rowell wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Date: 08 Jul 2003 15:21:33 -0500
>>>>From: Richard Rowell <richard@bowmansystems.com>
>>>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
>>>>Subject: Re: [SQL] Datatype conversion help
>>>>
>>>>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>I've tried to_char(in_val, '99'), and that returns a string that is two
>>>>>
>>>>>
>>>>>
>>>>>
>>>>select to_char(9,'00');
>>>>
>>>>
>>>>
>>>>
>>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 8: explain analyze is your friend
>>>
>>>
>>>
>>>
>>
>>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Datatype conversion help
@ 2003-07-10 05:58 listrec <listrec@epecon.de>
parent: Dmitry Tkach <dmitry@openratings.com>
1 sibling, 0 replies; 13+ messages in thread
From: listrec @ 2003-07-10 05:58 UTC (permalink / raw)
To: Dmitry Tkach <dmitry@openratings.com>; Yasir Malik <ymalik@cs.stevens-tech.edu>; +Cc: pgsql-sql
I tried
select
to_date(substring(to_char(yr,'0009'),2,4)||substring(to_char(mn,'09'),2,2)||
substring(to_char(dy,'09'),2,4),'YYYYMMDD');
which works fine....
Detlef
-----Ursprungliche Nachricht-----
Von: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]Im Auftrag von Dmitry Tkach
Gesendet: Donnerstag, 10. Juli 2003 00:52
An: Yasir Malik
Cc: pgsql-sql@postgresql.org
Betreff: Re: [SQL] Datatype conversion help
Yasir Malik wrote:
>I used trim and here's what I came up with:
>to_date(trim(to_char(yr, '9999') || trim(to_char(mn, '00')) ||
>trim(to_char(dy, '00'))), 'YYYYMMDD')
>
>Apparently to_char adds a space to the charecter you are casting.
>
>
I know :-)
And lpad doesn't - that's why I suggested it :-)
Dima
>
>On Wed, 9 Jul 2003, Dmitry Tkach wrote:
>
>
>
>>Date: Wed, 09 Jul 2003 18:40:37 -0400
>>From: Dmitry Tkach <dmitry@openratings.com>
>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
>>Cc: pgsql-sql@postgresql.org
>>Subject: Re: [SQL] Datatype conversion help
>>
>>What about lpad?
>>
>>select lpad (7, 2, 0) || '-' || lpad (9, 2, '0') || '-2003';
>> ?column?
>>------------
>> 07-09-2003
>>(1 row)
>>
>>
>>I hope, it helps...
>>
>>Dima
>>
>>Yasir Malik wrote:
>>
>>
>>
>>>Thank you so much! But my problem is that when I do
>>>to_char(mn, '00') || '-' || to_char(dy, '00') || '-' || to_char(yr,
>>>'9999')
>>>
>>>where mn, dy, and yr are ints, is that the output has a space after the
>>>the dash. For example, I get
>>>07- 25- 1994
>>>
>>>instead of what I want:
>>>07-25-1994
>>>
>>>Thanks,
>>>Yasir
>>>
>>>On Tue, 8 Jul 2003, Richard Rowell wrote:
>>>
>>>
>>>
>>>
>>>
>>>>Date: 08 Jul 2003 15:21:33 -0500
>>>>From: Richard Rowell <richard@bowmansystems.com>
>>>>To: Yasir Malik <ymalik@cs.stevens-tech.edu>
>>>>Subject: Re: [SQL] Datatype conversion help
>>>>
>>>>On Tue, 2003-07-08 at 15:07, Yasir Malik wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>I've tried to_char(in_val, '99'), and that returns a string that is two
>>>>>
>>>>>
>>>>>
>>>>>
>>>>select to_char(9,'00');
>>>>
>>>>
>>>>
>>>>
>>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 8: explain analyze is your friend
>>>
>>>
>>>
>>>
>>
>>
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
^ permalink raw reply [nested|flat] 13+ messages in thread
* Datatype Conversion help
@ 2003-07-16 00:41 Ramesh Kumar B <bramesh77@rediffmail.com>
0 siblings, 0 replies; 13+ messages in thread
From: Ramesh Kumar B @ 2003-07-16 00:41 UTC (permalink / raw)
To: pgsql-sql
How do i can convert character varying type to integer
___________________________________________________
Click below to experience Sooraj R Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik, Abhishek
& Kareena http://www.mpkdh.com
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2003-07-16 00:41 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-07-08 20:07 Datatype conversion help Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-07-08 20:26 ` Michael A Nachbaur <mike@nachbaur.com>
2003-07-08 20:28 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-07-08 20:45 ` Michael A Nachbaur <mike@nachbaur.com>
2003-07-09 22:40 ` Dmitry Tkach <dmitry@openratings.com>
2003-07-09 18:49 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-07-09 22:51 ` Dmitry Tkach <dmitry@openratings.com>
2003-07-09 18:55 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-07-10 05:58 ` listrec <listrec@epecon.de>
2003-07-08 21:02 Re: Datatype conversion help David Olbersen <DOlbersen@stbernard.com>
2003-07-08 21:19 ` Yasir Malik <ymalik@cs.stevens-tech.edu>
2003-07-09 08:29 ` Richard Huxton <dev@archonet.com>
2003-07-16 00:41 Datatype Conversion help Ramesh Kumar B <bramesh77@rediffmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox