请问在mysql中,修改一个表中的字段名,并不能影响这的字段中的数据,这的功能用什么语句实现?
maybe ALTER.
你说的sp_rename是sql server中提供的系统存储过程,mysql中没有这个命令.mysql和sql server不是同一产品,前者是瑞典一公司的产品后者是微软的产品.
You can rename a column using a CHANGE old_col_name create_definition clause.
To do so, specify the old and new column names and the type that the column currently
has. For example, to rename an INTEGER column from a to b, you can do this:
mysql> ALTER TABLE t1 CHANGE a b INTEGER;
If you want to change a columns type but not the name, CHANGE syntax still requires
two column names even if they are the same. For example:
430 MySQL Technical Reference for Version 4.0.1-alpha
mysql> ALTER TABLE t1 CHANGE b b BIGINT NOT NULL;
However, as of MySQL Version 3.22.16a, you can also use MODIFY to change a columns
type without renaming it:
mysql> ALTER TABLE t1 MODIFY b BIGINT NOT NULL;