Обсуждение: convert text to varchar

Поиск
Список
Период
Сортировка

convert text to varchar

От
JT Kirkpatrick
Дата:
hi!  i have a text field (table ap3, field name apnote) that i would like 
to insert into a varchar field (same field name, table name ap).  any idea 
why this doesn't work?  insert into ap (apnote) select varchar('apnote') 
from ap3; -- it fails with or without the single quotes.

TIA, jt


Re: [SQL] convert text to varchar

От
Herouth Maoz
Дата:
At 18:33 +0300 on 03/05/1999, JT Kirkpatrick wrote:


> hi!  i have a text field (table ap3, field name apnote) that i would like
> to insert into a varchar field (same field name, table name ap).  any idea
> why this doesn't work?  insert into ap (apnote) select varchar('apnote')
> from ap3; -- it fails with or without the single quotes.

Should be simply

INSERT INTO ap (apnote)
SELECT ap3.apnote
FROM ap3;

You really shouldn't have single quotes, and the conversion to text is
supposed to be automatic.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma