suppose u want to change column a in table t, from varchar(20) to numeric(20) and change its name from a to b,
u can use
ALTER TABLE t CHANGE a b numeric(20);
value in the column will be truncated, if the memory of new type is not big enough to store this value;
As for primary key, if u want to change its type from one to another, u should make sure that there won't be two duplicate value in that column after u do the transformation. otherwise, it will refuse to do the job
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!
Don't forget to always have a dream
我曾是孤单的飞鸟
飘荡在远方的天空
如今我已飞得太久
才知道我就是春天
我用力地挥动翅膀
开始寻找家的方向
我用力地挥动翅膀
溶进这宽阔的天空