| От | Mike Diehl |
|---|---|
| Тема | Can't cast from char to integer... |
| Дата | |
| Msg-id | 200809291331.12623.mdiehl@diehlnet.com обсуждение |
| Ответы |
Re: Can't cast from char to integer...
|
| Список | pgsql-general |
Hi all.
I'm trying to cut data from one table and put it in another table. The
problem comes from the fact that the first table has a field that is a
char(x) and the destination table needs that data in an integer.
For example, I'm trying to do this:
insert into data
select cast('666' as integer) as block_number, phone as phone_number, name
from demo_q;
The data table has a field called block_number that is an integer. I'm trying
to populate that field with the INTEGER, 666. (I use 666 for testing since I
would never assign that number/id to an actuall customer.)
When I run this query, I get:
ERROR: column "block_number" is of type integer but expression is of type
character varying
What am I doing wrong?
TIA,
--
Mike Diehl
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера