Skip to content

Identity

Andrey Gershun edited this page May 26, 2015 · 4 revisions

IDENTITY, AUTO_INCREMENT, AUTOINCREMENT

AlaSQL supports autoincrement feature:

    alasql('CREATE TABLE one (a INT AUTO_INCREMENT, b STRING)');
    alasql('INSERT INTO one (b) VALUES ("one"), ("two")');
    var res = alasql('SELECT * FROM one');
    // returns [{"a":1,"b":"one"},{"a":2,"b":"two"}]

Try this example in jsFiddle

By default AlaSQL the initial value is 1 and th step is 1, but you can change it:

    alasql('CREATE TABLE one (a INT IDENTITY(10,5), b STRING)');
Clone this wiki locally