Received: from c014.sfo.cp.net (c014-h017.c014.sfo.cp.net [209.228.12.81]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f1Q4BVx99238 for ; Sun, 25 Feb 2001 23:11:32 -0500 (EST) (envelope-from ken@oldbs.com) Received: (cpmta 2964 invoked from network); 25 Feb 2001 20:11:23 -0800 Received: from unknown (HELO oldbs.com) (216.91.245.19) by smtp.oldbs.com (209.228.12.81) with SMTP; 25 Feb 2001 20:11:23 -0800 X-Sent: 26 Feb 2001 04:11:23 GMT Message-ID: <3A99D769.94EF54B6@oldbs.com> Date: Sun, 25 Feb 2001 23:11:22 -0500 From: Ken Kline X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.16-22min_for_stan i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: conversion References: <3A99C025.BBF58939@oldbs.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/394 X-Sequence-Number: 1599 follow up.... actually the destination column is defined as a numeric(4) the following are the statements again with there error messages: SELECT pseason, to_number(pyear,'9999') from temp; ERROR: Bad numeric input format ' ' SELECT pyear::int from temp; ERROR: Cannot cast type 'varchar' to 'int4' Ken Kline wrote: > Hello, > another brain twister, at least for me... > i have a table of varchar and one of the values I want > to insert into another table, one of the columns is > defined as INTEGER in destination table, column... > and none of these statements seem to work > > INSERT INTO pledge_classes (semester, year) > SELECT pseason, to_number('pyear','9999') from temp; > > INSERT INTO pledge_classes (semester, year) > SELECT pseason, pyear::integer from temp; > > INSERT INTO pledge_classes (semester, year) > SELECT pseason, pyear::numeric(4) from temp;