Re: smallint-->char?
Posted in 1998
Topics: General Discussion
Jim Kistler wrote:
> I've changed the datatype on a column from smallint to character and
> then am trying to "update" the entries to map the "old" integers to
> letters:
>
> 0 --> n (none)
> 1 --> l (low)
> 2 --> h (high)
[SNIP]
OK, maybe I am missing something here.
I just tried this on Online 7.2x on NT.
I created a table with a serial and a smallint field.
Table: foo
id serial
val smallint;
I added several rows.
Insert into foo values (0,1);then several more with the value 2
then several more with the value 3;
I then did an alter table.
(BTW, There is a bug in the Table editor... ;-)
I used an SQL statement just to be sure that it could be duplicated in any
environment.
I then did the following:
UPDATE foo
SET val = 'L'
WHERE val = '1';
I used L since l looks like 1.
No problem.
I think your problem may have occured because you were using " instead of '.
So what am I missing?
-Mikey