2014年07月15日

SQLite3 AUTOINCREMENT

create table TEST_NO_1 (seq_id INTEGER PRIMARY KEY AUTOINCREMENT, di integer);
create table TEST_NO_2 (seq_id INTEGER PRIMARY KEY AUTOINCREMENT, di integer);
create table TEST_NO_3 (seq_id INTEGER PRIMARY KEY AUTOINCREMENT, di integer);

insert into TEST_NO_1 (di) values (1);

insert into TEST_NO_2 (di) values (1);
insert into TEST_NO_2 (di) values (1);

insert into TEST_NO_3 (di) values (1);
insert into TEST_NO_3 (di) values (1);
insert into TEST_NO_3 (di) values (1);

.mode colum
select * from sqlite_sequence;

update sqlite_sequence set seq = 22 where name = 'TEST_NO_3';

select seq_id from TEST_NO_3 order by seq_id desc;

select ROWID from TEST_NO_3;
select ROWID+1 from TEST_NO_3;
select (ROWID+1) As NextVal from TEST_NO_3;
select ROWID,* from TEST_NO_3;


posted by a23 at 13:29| Comment(0) | SQLite
この記事へのコメント
コメントを書く
お名前:

メールアドレス:

ホームページアドレス:

コメント: