JDBC sql server:设置 IDENTITY_INSERT ON:无效。
PreparedStatement stmt = connection.prepareStatement("SET IDENTITY_INSERT Table_FOO ON");
stmt.execute();
stmt.close();
PreparedStatement stmt2 = connection.prepareStatement("insert into Table_FOO (id, name) values (100, 'abc')");
stmt2.execute();
stmt2.close();
错误:仍然抱怨 DENTITY_INSERT 为 OFF。
com.microsoft.sqlserver.jdbc.SQLServerException:当 IDENTITY_INSERT 设置为 OFF 时,无法在表“Table_FOO”中插入标识列的显式值。