错误SQL 查询:SET IDENTITY_INSERT tablename ON ;MySQL 返回:文档
#1193 - Unknown system variable 'IDENTITY_INSERT' 出现这个错误,想知道如何写正确?

解决方案 »

  1.   

    自增字段在MYSQL中可以不写,假设ID为自增
    insert into tt(f1,f2,...) values(....)
      

  2.   

    自增设置是在建表的时候设置好的吧   从没见过楼主这种写法
    mysql> create table test(id int auto_increment primary key,b int)
        -> ;
    Query OK, 0 rows affected (0.04 sec)mysql> insert into test(b) values(1);
    Query OK, 1 row affected (0.02 sec)mysql> insert into test(b) values(1);
    Query OK, 1 row affected (0.02 sec)mysql> insert into test(b) values(1);
    Query OK, 1 row affected (0.01 sec)mysql> select * from test;
    +----+------+
    | id | b    |
    +----+------+
    |  1 |    1 |
    |  2 |    1 |
    |  3 |    1 |
    +----+------+
    3 rows in set (0.00 sec)mysql> 
      

  3.   

    MYSQL与MS SQL SERVER不同,建议参考一下MYSQL的官方免费手册,MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html