SELECT CHR(CAST(65 + FLOOR(RAND() * 3) AS INTEGER)) AS LETTERS FROM table(VALUES 1, 2, 3, 4) -- result: ==================== | LETTERS: CHAR(1) | ==================== | A | | B | | A | | C | ==================== -- Usable in update statement: UPDATE MyTable SET MyColumn = CHR(CAST(65 + FLOOR(RAND() * 3) AS INTEGER))
541600cookie-checkSQL Generate random letters