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
---(end of broadcast
ag von Dmitry Tkach
Gesendet: Donnerstag, 10. Juli 2003 00:52
An: Yasir Malik
Cc: [EMAIL PROTECTED]
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, '') || trim(to_char(mn, '00'
; >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: W
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 <[EMAIL PROTECTED]>
To: Yasir Malik <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: Re: [SQL] Datatype conversion he
ach wrote:
> Date: Wed, 09 Jul 2003 18:40:37 -0400
> From: Dmitry Tkach <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [SQL] Datatype conversion help
>
> What about lpad?
>
> select lpad (7, 2, 0) || '-
Jul 2003 15:21:33 -0500
From: Richard Rowell <[EMAIL PROTECTED]>
To: Yasir Malik <[EMAIL PROTECTED]>
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 ret
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(, 'MM-DD-)
> 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
>
de 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 <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [SQL] Datatype conversion help
>
> Yasir,
>
> If this is a date you'
essage-
> From: Yasir Malik [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 08, 2003 1:29 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [SQL] Datatype conversion help
>
>
> Thank you so much! But my problem is that when I do
> to_char(mn, '00') || '-' |
r 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 <[EMAIL PROTECTED]>
> > To:
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 <[EMAIL PROTECTED]>
> To: Yasir Malik <[EMAIL PROTECTED]>
> Subject: Re: [SQL] Datatype conversion help
>
> On Tue, 2
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
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.
13 matches
Mail list logo