Re: Returning String as Integer

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Returning String as Integer
Дата
Msg-id 20060506153916.GA3434@wolff.to
обсуждение исходный текст
Ответ на Re: Returning String as Integer  (Jorge Godoy <jgodoy@gmail.com>)
Ответы Re: Returning String as Integer  ("Ben K." <bkim@coe.tamu.edu>)
Список pgsql-sql
On Fri, May 05, 2006 at 18:52:19 -0300, Jorge Godoy <jgodoy@gmail.com> wrote:
> Em Sexta 05 Maio 2006 18:37, Kashmira Patel (kupatel) escreveu:
> > Hi all,
> >    I have a table with a column of type 'text'. It mainly contains
> > numbers. Is there any way to select a value from this column and return
> > it as an integer?
> 
> testing=# select '123'::integer;
>  int4 
> ------
>   123
> (1 registro)

Note that that isn't the same thing. The '123' above is not treated as
being of type text. If you actually wanted to test this conversion you
would want to do:
bruno=> select '123'::text::integer;int4
------ 123
(1 row)


В списке pgsql-sql по дате отправления:

Предыдущее
От: Markus Schaber
Дата:
Сообщение: Re: Most efficient way to hard-sort records
Следующее
От: "kernel.alert kernel.alert"
Дата:
Сообщение: problem with uniques and foreing keys