CAST from VARCHAR to INT

From: "Luke Pascoe" <luke(dot)p(at)kmg(dot)co(dot)nz>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: CAST from VARCHAR to INT
Date: 2003-01-24 02:56:19
Message-ID: 01df01c2c354$2bac5a60$3200000a@K2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

(Postgres 7.2.1)

I screwed up when I was designing a table a while back and made a column a
VARCHAR that referenced (and should have been) an INT.

Now I'm trying to correct my mistake, I've created a new table and I'm
trying to INSERT INTO...SELECT the data into it, but it's complaining that
it can't stick a VARCHAR into an INT. All the values in the column are valid
integers (the foreign key sees to that) but even a CAST won't do it.

How can I force it to copy/change the values?

========================================
Luke Pascoe
Senior Developer / Systems administrator
KMG (NZ) Limited. http://www.kmg.co.nz
Mobile: (021) 303019
Email: luke(dot)p(at)kmg(dot)co(dot)nz
========================================

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Horst Herb 2003-01-24 02:58:14 Re: SQL to list databases?
Previous Message Ed L. 2003-01-24 02:39:03 Re: Scheduling Events?