您不需要设置IDENTITY INSERT,因为始终可以显式设置该值.使用SQLite,您只需插入ROWID列:
drop table test;
create table test(name varchar);
insert into test(name) values('Hello');
insert into test(rowid, name) values(10, 'World');
select rowid, name from test;
Run Code Online (Sandbox Code Playgroud)
如果您使用自动增量主键,则相同:
drop table test;
create table test(id integer primary key autoincrement, name varchar);
insert into test(name) values('Hello');
insert into test values(10, 'World');
select * from test;
Run Code Online (Sandbox Code Playgroud)
另见http://www.sqlite.org/autoinc.html
| 归档时间: |
|
| 查看次数: |
1749 次 |
| 最近记录: |