Received: from rainbow.cc.rl.ac.uk (rainbow.cc.rl.ac.uk [130.246.74.66]) by hub.org (8.8.8/8.7.5) with ESMTP id KAA16165 for ; Mon, 18 May 1998 10:50:17 -0400 (EDT) Received: from rainbow.cc.rl.ac.uk (localhost [127.0.0.1]) by rainbow.cc.rl.ac.uk (8.8.8/8.8.8) with SMTP id PAA27239 for ; Mon, 18 May 1998 15:50:12 +0100 (BST) Sender: street@rainbow.cc.rl.ac.uk Message-ID: <35604AA3.41C6@rl.ac.uk> Date: Mon, 18 May 1998 15:50:11 +0100 From: Rachel Kay Street Organization: Rutherford Appleton Laboratory X-Mailer: Mozilla 3.0Gold (X11; I; OSF1 V4.0 alpha) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: SQL Syntax: char to varchar type conversion(s) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, Can anyone answer this SQL question? I have a field of type char in one table and wish to insert this into a second table (with other fields) but the new field is of type varchar. How do I proceed? The following (test) fails in pgsql. create table temp1 ( code char(2) ); insert into temp1 values ('AB'); select * from temp1; create table temp2 ( code1 char(10), code2 varchar(10) ); insert into temp2 (code1,code2) select code,code from temp1; select * from temp2; Rachel Street **************************************************************** * R K Street - RAL Database Systems - (01235) 821900 ext 5833 * * Rutherford Appleton Laboratory, Chilton, DIDCOT, Oxon, UK * * Email: R.K.Street@rl.ac.uk or street@wdcc1.bnsc.rl.ac.uk * ****************************************************************