This is my actual string, still not working: const char * replaceSql = "INSERT INTO "EVENTLOG_TBL \ "(_ROWID_, component, facilityId, logLevel,"\ "textMessage, binMessage) VALUES(?,?,?,?,?,?); SELECT max(ROWID) from EVENTLOG_TBL";
On Fri, Feb 5, 2010 at 3:05 PM, Vasanta <vtan...@gmail.com> wrote: > Thanks jay. > > Can I combine like this: > > "INSERT INTO trends(UnitID,HeureTrends,DateTrends) VALUES(?,?,?);SELECT > max(ROWID) FROM table-name"; > > or > > "INSERT INTO trends(UnitID,HeureTrends,DateTrends) VALUES(?,?,?);SELECT > last_insert_rowid() AS [ID]"; > > > On Fri, Feb 5, 2010 at 2:49 PM, Jay A. Kreibich <j...@kreibi.ch> wrote: > >> On Fri, Feb 05, 2010 at 02:28:33PM -0500, Vasanta scratched on the wall: >> > command "SELECT rowid from table-name;" gives all rows from 1 to 100 >> for >> > total 100 rows, any command to get last rowid?. I need insert from last >> > rowid onwards (if table already 100 records, need to insert from 101 >> > onwards) >> >> SELECT max(ROWID) FROM table-name; >> >> >> You shouldn't be setting ROWIDs manually, however. Just insert the >> row and let SQLite pick the ROWID. If you have a ROWID alias in the >> form of an INTEGER PRIMARY KEY, in most cases you should still just >> let SQLite pick the value, possibly with AUTOINCREMENT. >> >> -j >> >> -- >> Jay A. Kreibich < J A Y @ K R E I B I.C H > >> >> "Our opponent is an alien starship packed with atomic bombs. We have >> a protractor." "I'll go home and see if I can scrounge up a ruler >> and a piece of string." --from Anathem by Neal Stephenson >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users