Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group