Re: [SQL] convert text to varchar

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: JT Kirkpatrick <jt-kirkpatrick(at)mpsllc(dot)com>, "'pgsql-sql(at)hub(dot)org'" <pgsql-sql(at)hub(dot)org>
Subject: Re: [SQL] convert text to varchar
Date: 1999-05-03 16:02:15
Message-ID: l03130308b3537874e3d1@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 1999-05-03 16:19:04 Re: [SQL] No DIVIDE Operator
Previous Message Tom Lane 1999-05-03 15:47:04 Re: [SQL] Slow Inserts Again