1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
with cte (id, titre_long)
as
(
select 1, 'quelque chose par quelqu''un'
union all
select 2, 'K par K'
union all
select 3, 'un par un'
union all
select 4, 'sauter par dessus'
union all
select 5, 'marche pas'
union all
select 6, 'un parking'
union all
select 7, 'test par-dessus la jambe'
)
select id, SUBSTRING(titre_long, 1, charindex(' par ', titre_long, 1)) titre
from cte
where charindex(' par ', titre_long, 1) > 0
union all
select id, titre_long
from cte
where charindex(' par ', titre_long, 1) = 0; |
Partager