Subject | changing column type |
---|---|
Author | Pablo Sánchez |
Post date | 2003-05-08T22:18:48Z |
Hi, i must change a column type from string to integer.
Note that the column is PK.
1. Create new column (column1) with same type (string)
2. Put the values from original column to column1
-> update mytable set column1 = column
3. Change original column type (to integer)
4. Put the values back in the original column (from column1)
-> update mytable set column = column1
5. Drop column1
Now, i : select * from mytable order by original column
shows ordered as if data was string, not numbers.
As i see, there is no automatic conversion here.
Any hints ?
Thanks in advance.
Pablo Sánchez.
pablos EN adinet.com.uy
Note that the column is PK.
1. Create new column (column1) with same type (string)
2. Put the values from original column to column1
-> update mytable set column1 = column
3. Change original column type (to integer)
4. Put the values back in the original column (from column1)
-> update mytable set column = column1
5. Drop column1
Now, i : select * from mytable order by original column
shows ordered as if data was string, not numbers.
As i see, there is no automatic conversion here.
Any hints ?
Thanks in advance.
Pablo Sánchez.
pablos EN adinet.com.uy