[R] sqlite create new unique id
Alok Jadhav
alok.jadhav at credit-suisse.com
Tue Feb 21 07:58:37 CET 2012
Hi everyone,
I am trying to insert a row in sqlite table with my own unique id. I want
to create unique id using sqlite internal function
last_insert_rowid() which returns the next max rowid of the table which is
always unique. I tested this using sqlite and it works fine but when i run
the same query using RSQlite from r prompt, my query doesn't create new
unique id.
last_insert_rowid() always returns 0 value from RSQLite always returns 0.
How can I get a unique id using RSQLite ?
my query looks like this
"insert into PrimaryIdTable values ('AMP AT
Equity','bbg','2001-01-01','2099-01-01','P'||last_insert_rowid())"
reason i am not using INTEGER PRIMARY KEY is because i want to keep my key
as TEXT datatype. This is because another table has same field for secondary
id and both these keys appear in same table so i want to call them primary
key (P1, P2 ) or secondary key (S1, S2 etc) .
Thanks for your help,
Alok
--
View this message in context: http://r.789695.n4.nabble.com/sqlite-create-new-unique-id-tp4406114p4406114.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list