Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Multiple updates?
Thu, Feb 20 2020 10:48 AMPermanent Link

COMSPOC

Hi All,

We recently discovered that it's possible to do an 'array insert' with Elevate like so:

INSERT INTO SOMETABLE (COLA, COLB) VALUES ('A','B'), ('C','D'), ('E', 'F');

In our particular use case this is many times faster than inserting each row in its own statement, so our developers are asking if there is a syntax that would allow the same sort of functionality with updates? I'm may be interpreting it wrong, but the way I read the syntax diagram the multi-row insert doesn't appear to be possible, so I'm hoping the update might have another hidden gem Smile

Thanks.
Sun, Mar 22 2020 6:35 AMPermanent Link

Fernando Dias

Team Elevate Team Elevate

AGI

I don't know if this is what you are looking for, but here it is:

UPDATE ATable
  SET BColumn =
    CASE
      WHEN AColumn = 7 THEN 'x'
      WHEN AColumn = 8 THEN 'y'
      WHEN AColumn = 9 THEN 'z'
    END

It will update a column in multiple rows, depending on a condition, with a single statement.

--
Fernando Dias
[Team Elevate]
Image