EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 6:58 PM
Subject: Re: [SQL] CAST from VARCHAR to INT
>
> > (Postgres 7.2.1)
> >
> > I screwed up when I was designing a table a while back and made a column
a
> > VARCHAR that referenced (a
daq <[EMAIL PROTECTED]> writes:
> Make your life easier! :) You must write a function like
> this:
> create function "int4"(character varying) returns int4 as '
>DECLARE
> input alias for $1;
>BEGIN
> return (input::text::int4);
>END;
> ' language
Hello!
Like others said you can't cast varchar to int directly.
Make your life easier! :) You must write a function like
this:
create function "int4"(character varying) returns int4 as '
DECLARE
input alias for $1;
BEGIN
return (input::text::int4);
E
"Luke Pascoe" <[EMAIL PROTECTED]> writes:
> 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
> (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 compla
(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 c