Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread Tim Romano
If you want to "combine two tables" by copying rows from TableB into TableA, and TableA has an autoincrementing primary key, there is no need to reference the PK column in the SQL statement: insert into TableA(address, weight) select address, weight from TableB The approach above does indeed "b

Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread P Kishor
On Mon, Mar 15, 2010 at 9:18 AM, dravid11 wrote: > > As i told you before i am using this database inside an application which is > merging/combining one source database table to destination database table. > > So in that case i am not writing the actual insert query.and in that case > all columns

Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread dravid11
As i told you before i am using this database inside an application which is merging/combining one source database table to destination database table. So in that case i am not writing the actual insert query.and in that case all columns are taken. The trigger inside the database should handle

Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread P Kishor
On Mon, Mar 15, 2010 at 8:32 AM, dravid11 wrote: > > Well the situation is that i am merging data of one table in data of another > table using a program > so it is going to add all values by it self .I am not actually using insert > query in that case to select values to add. > > > There is anoth

Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread dravid11
Well the situation is that i am merging data of one table in data of another table using a program so it is going to add all values by it self .I am not actually using insert query in that case to select values to add. There is another scenario , what if inserting a data and i want to bypass th

Re: [sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread Tim Romano
If all you want to do is to insert a new row, do not mention the primary key column name in the insert statement: INSERT INTO temp (address, weight) values( "blah blah", 100) The autoincrementing primary key will be autoincremented. Regards Tim Romano On 3/15/2010 9:15 AM, dravid11 wrote: > H

[sqlite] On conflicting Primary key how to insert record and increment the Key

2010-03-15 Thread dravid11
Hello ! I have been trying to search for this solutions for days,yet did not find the solution. I want to write an insert query on a table. When there is a conflicting primary key then it should increment the primary key and insert the row . For example i want to run this query INSERT INTO t