Getting the primary key back from a SQL insert with SQLLite
Posted
by Paul Nathan
on Stack Overflow
See other posts from Stack Overflow
or by Paul Nathan
Published on 2010-05-04T06:56:09Z
Indexed on
2010/05/04
6:58 UTC
Read the original article
Hit count: 307
Hi,
I have a SQL table set that looks like this
create table foo (
id int primary key asc, data datatype );
create table bar (
id int primary key asc,
fk_foo int,
foreign key(foo_int) references foo(id));
Now, I want to insert a record set.
insert into table foo (data) values (stuff);
But wait - to get Bar all patched up hunkydory I need the PK from Foo. I know this is a solved problem.
What's the solution?
© Stack Overflow or respective owner