Datatype conversion help

From: Yasir Malik <ymalik(at)cs(dot)stevens-tech(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Datatype conversion help
Date: 2003-07-08 20:07:05
Message-ID: Pine.SGI.4.51.0307081604030.4185018@guinness.cs.stevens-tech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Michael A Nachbaur 2003-07-08 20:26:23 Re: Datatype conversion help
Previous Message Joe Conway 2003-07-08 16:34:39 Re: Setuid functions