How to set primary key in SQLCreateTable to be auto_increment

0

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?

Izabela Kowalska

Posted 2017-11-28T12:30:48.417

Reputation: 1

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? – Albert Retey – 2017-11-28T13:43:37.807

I'm using HSQL, so I need INTEGER IDENTITY. Thank You for a tip about database-engine. – Izabela Kowalska – 2017-11-30T12:00:03.270

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. – Albert Retey – 2017-11-30T12:47:12.873

No answers