Closed randomGitBeing132 closed 5 months ago
Hey 👋
Use the NOT
keyword.
await db
.updateTable('table')
.set('is_enabled', (eb) => eb.not('is_enabled'))
.where('table_id', '=', 1)
.execute();
Thank you for the help, but i got this error upon using it
Error: Incorrect syntax near the keyword \'not\'.\n at RequestTokenHandler.onErrorMessage
What dialect are you using?
What dialect are you using?
MSSQL
Use expression builder's neg
method:
import { SqlBool, sql } from "kysely";
await db
.updateTable("table")
.set("is_enabled", (eb) => eb.neg("is_enabled"))
.where("table_id", "=", 1)
.execute()
@randomGitBeing132 see updated answer.
Hi, i have a boolean value isEnabled and I would like to set it to the opposite value in my update statement
How do i translate this to kysely syntax?
Thank you