1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| WITH
T0 AS (
SELECT CASE WHEN POSITION(';', PRENOMS) > 0
THEN LEFT(PRENOMS, POSITION(';', PRENOMS) -1)
ELSE PRENOMS
END AS PRENOM,
CASE WHEN POSITION(';', PRENOMS) > 0
THEN RIGHT(PRENOMS, CHARACTER_LENGTH(PRENOMS) - POSITION(';', PRENOMS))
ELSE PRENOMS
END AS PRENOMS
FROM MaTable
UNION ALL
SELECT CASE WHEN POSITION(';', PRENOMS) > 0
THEN LEFT(PRENOMS, POSITION(';', PRENOMS) -1)
ELSE PRENOMS
END AS PRENOM,
CASE WHEN POSITION(';', PRENOMS) > 0
THEN RIGHT(PRENOMS, CHARACTER_LENGTH(PRENOMS) - POSITION(';', PRENOMS))
ELSE PRENOMS
END AS PRENOMS
FROM T0
WHERE PRENOMS <> PRENOM; |
Partager