sqlpage.variables(method) and UPDATE #1004
Answered
by
DSMejantel
DSMejantel
asked this question in
Q&A
Answered by
DSMejantel
Aug 30, 2025
Replies: 4 comments 3 replies
|
I just.understand than a SET IS not like a SELECT and it can't work with FROM |
0 replies
|
Hello ! The error message is indeed confusing. Since sqlpage does not enforce semicolons at the end of statements, and both UPDATE plats
SET name=CAST(value AS TEXT) WHERE id=CAST(key AS INTEGER)and are syntactically valid (in different sql dialects), you do not get the parse error that would be expected here. |
0 replies
|
The correct syntax for what you want to do is UPDATE plats
SET name=CAST(var.value AS TEXT)
FROM JSON_EACH(sqlpage.variables('post')) as var
WHERE plats.id=CAST(var.key AS INTEGER); |
1 reply
|
Wonderful ! as var |
2 replies
Answer selected by
DSMejantel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Wonderful !
Merci pour tes explications encore une fois claires et pédagogiques. Cela fonctionne en rajoutant
as var