[sqlite] How to inject primary keys which are set to autoincrement in sqlite??

2010-09-10 Thread Anthony Main
In MS SQL I would use

SET IDENTITY INSERT ON

How do I do something similar in SQLite. I am trying to upgrade a database
and want to maintain the IDs from the original

Thanks
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to inject primary keys which are set to autoincrement in sqlite??

2010-09-10 Thread Anthony Main
In MS SQL I would use

SET IDENTITY INSERT ON

How do I do something similar in SQLite. I am trying to upgrade a database
and want to maintain the IDs from the original

Thanks
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to inject primary keys which are set to autoincrement in sqlite??

2010-09-09 Thread Simon Davies
On 9 September 2010 12:22, tigermain  wrote:
>
> In MS SQL I would use
>
> SET IDENTITY INSERT ON
>
> How do I do something similar in SQLite. I am trying to upgrade a database
> and want to maintain the IDs from the original

You choose whether to include the key as part of the insert statement.

SQLite version 3.6.11
Enter ".help" for instructions
sqlite> create table tst( id integer primary key, data text );
sqlite> insert into tst( data ) values( 'd1' ); -- key assigned by 
sqlite
sqlite> insert into tst( data ) values( 'd2' );
sqlite>
sqlite> select * from tst;
1|d1
2|d2
sqlite>
sqlite> insert into tst( id, data ) values( 101, 'd101' );  -- key 
in
insert statement
sqlite> insert into tst( id, data ) values( 102, 'd102' );
sqlite>
sqlite> select * from tst;
1|d1
2|d2
101|d101
102|d102
sqlite>
sqlite>
sqlite> insert into tst( data ) values( 'd103' );   -- key assigned 
by sqlite
sqlite>
sqlite> select * from tst;
1|d1
2|d2
101|d101
102|d102
103|d103
sqlite>

>
> Thanks
> --

Regards,
Simon
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to inject primary keys which are set to autoincrement in sqlite??

2010-09-09 Thread tigermain

In MS SQL I would use

SET IDENTITY INSERT ON

How do I do something similar in SQLite. I am trying to upgrade a database
and want to maintain the IDs from the original

Thanks
-- 
View this message in context: 
http://old.nabble.com/How-to-inject-primary-keys-which-are-set-to-autoincrement-in-sqlite---tp29647839p29647839.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to inject primary keys which are set to autoincrement in sqlite??

2010-09-09 Thread tigermain

In MS SQL I would use

SET IDENTITY INSERT ON

How do I do something similar in SQLite. I am trying to upgrade a database
and want to maintain the IDs from the original

Thanks
-- 
View this message in context: 
http://old.nabble.com/How-to-inject-primary-keys-which-are-set-to-autoincrement-in-sqlite---tp29647838p29647838.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users