-
Notifications
You must be signed in to change notification settings - Fork 689
Update
Mathias Wulff edited this page Dec 15, 2025
·
11 revisions
Syntax:
UPDATE table SET prop1 = value1, ... WHERE conditionFor example:
alasql("UPDATE events SET synchronized = ? WHERE name = ?", [true, event.name]);
alasql('UPDATE cities SET population = population * 1.5 WHERE name LIKE "A%"');
alasql('UPDATE city SET population = LEN(name) * 1000000 WHERE name LIKE "M%"');You can use the OUTPUT clause to return the updated data (both old and new values).
// Return the new values
alasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT INSERTED.*');
// Return the old values
alasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT DELETED.*');
// Return both old and new values
alasql('UPDATE cities SET population = population * 1.5 WHERE name = "Paris" OUTPUT DELETED.population AS old_pop, INSERTED.population AS new_pop');An UPDATE statement will return the amount of rows updated by the statment.
© 2014-2026, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo