我通过sql server2000 查询分析器创立了一个数据库,sql语句如下:
create table borrower
(借书证号 int not null,
 姓名    char(20),
 系名    char(20),
 班级    char(20));
然后发现借书证号应该是字符类型,所以我又通过sql语句
alter table borrower
modify 借书证号 char(20);
改变属性类型,可是查询分析器却出现“'借书证号' 附近有语法错误。”
请问为什么会出现这种情况,如何解决这个问题,谢谢。

解决方案 »

  1.   

    alter table borrower
    alter column 借书证号 char(20);
      

  2.   

    create table borrower
    (
      借书证号 int not null
    )
    alter table borrower
    alter column 借书证号 varchar(10) not nullalter table borrower
    add constraint pk_borrower_借书证号 primary key (借书证号)
      

  3.   

    难道不能用modify关键字吗?一定要写两条alter语句吗?谢谢
      

  4.   

    alter table borrower alter column 借书证号 char(20);这是一句语句modify 是oracle 的语法
      

  5.   

    modify是oracle语法吧,这里说的是MSSQL.
      

  6.   

    modify同时也是oracle,mysql的语法!