0
$\begingroup$

I'm trying to create a table using SQLCreateTable. What I need is auto incremented primary key. My table will be growing in time and I don't want to check previous value of primary key every time I will be adding new row. Right now my primary key can't be empty, so in each SQLInsert I need to specify it. Is there any chance to do it without SQLExecute?

$\endgroup$
  • $\begingroup$ the details of auto-incrementation are unfortunately database-engine specific. In some cases you might get away without SQLExecute, but in others not. Which system are you using? Why do you want to avoid SQLExecute? $\endgroup$ – Albert Retey Nov 28 '17 at 13:43
  • $\begingroup$ I'm using HSQL, so I need INTEGER IDENTITY. Thank You for a tip about database-engine. $\endgroup$ – Izabela Kowalska Nov 30 '17 at 12:00
  • $\begingroup$ I'm not sure, it is a while since I have used HSQL, but I'm afraid that you will need an SQLExecute with the matching CEATE TABE statement there. SQLite e.g. does automatically set autoincrement for integer primary keys, so there you could get away with just SQLCreateTable. $\endgroup$ – Albert Retey Nov 30 '17 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.