Re: CAST(integer_field AS character) truncates trailing zeros

From: Warren Bell <warren(at)clarksnutrition(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: CAST(integer_field AS character) truncates trailing zeros
Date: 2008-07-31 21:05:58
Message-ID: 48922936.5070400@clarksnutrition.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I guess it would help if I cast to the correct type. I was doing cast(
cast( 1000 as integer ) as char ) instead of character varying, char(n)
or text.

Thanks,

Warren

Warren Bell wrote:
> I am trying to cast an int to a character. The int is the number 1000
> it gets cast down to "1" and not "1000". How do I cast from int to
> character without loosing the trailing zeros?
>

--
Thanks,

Warren Bell
909-645-8864
warren(at)clarksnutrition(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-07-31 21:45:30 eliminating records not in (select id ... so SLOW?
Previous Message Douglas McNaught 2008-07-31 20:44:04 Re: CAST(integer_field AS character) truncates trailing zeros