已有表checks(payee,amount,res)
现在有需求给该表加一列checkId
并且表中每一行数据的checkId置为该行数据的行号
请教知情达人

解决方案 »

  1.   

    alter table checks add checkid int identity(1,1)
      

  2.   

    alter table [checks] add checkid int identity(1,1) not null
      

  3.   

    mysql> alter table checks add checkid int identity(1,1);
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'ident
    ity(1,1)' at line 1不行啊,出现错误啊
      

  4.   

    楼主去看看MYSQL的写法吧!加个自增列的语法。
      

  5.   

    --MYSQL的这么写alter table checks add checkid int unsigned not null auto_increment;