为什么不可以使用SQL中的,sp_rename "表名.字段名",字段名;?

解决方案 »

  1.   

    你说的sp_rename是sql server中提供的系统存储过程,mysql中没有这个命令.mysql和sql server不是同一产品,前者是瑞典一公司的产品后者是微软的产品.
      

  2.   

    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 column's 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 column's
    type without renaming it:
    mysql> ALTER TABLE t1 MODIFY b BIGINT NOT NULL;
      

  3.   

    thank you! have a question again!
    在 mysql ms-dos 方式下如何创建一个表格?
      

  4.   

    我在MS_DOS方式下这样写:mysql>create table sales (order int not null);不能通过,不知有什么问题?
      

  5.   

    order是关键字不能用来作字段名。
      

  6.   


    mysql>create table sales (pro_order int not null);也不行啊!
      

  7.   


    mysql>create table sales (pro_order int not null);也不行啊!
      

  8.   

    是不是没有选择在数据库.
    mysql>use test;
    mysql>create table sales (pro_order int not null);