From: Rachel Kay Street <Rachel.K.Street@rl.ac.uk>
To: pgsql-sql@postgresql.org
Subject: SQL Syntax: char to varchar type conversion(s)
Date: Mon, 18 May 1998 15:50:11 +0100
Message-ID: <35604AA3.41C6@rl.ac.uk> (raw)
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 *
****************************************************************
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Rachel.K.Street@rl.ac.uk
Subject: Re: SQL Syntax: char to varchar type conversion(s)
In-Reply-To: <35604AA3.41C6@rl.ac.uk>
References: <35604AA3.41C6@rl.ac.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox