Blog

SQL tips and tricks 1

SQL tips and tricks 1

Come controllare se una colonna carattere contiene valori numerici WITH T_01 (C02, C05, c07) AS (VALUES (’12’,’12345′, ‘1234567’), (‘1x’,’12M45′, ‘1234567’), (’12’,’12345′, ’12K4567′), (‘1a’,’12X45′, ‘123N567’), (‘1d’,’1c345′, ‘123d567’)) SELECT C02, (CASE WHEN (TRANSLATE(trim(C02), ‘NNNNNNNNNNX’, ‘1234567890N’)=’NN’) THEN ‘is numeric’ ELSE ‘not numeric’ END)…