add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select *
into t
from (values
('20 x 88 nc.'),
('100 x 300 nc'),
('200x 88 nc.'),
('5x 300 nc'),
('ol (200x 88nc.)'),
('ol (100x 300nc)'),
('90dfa (45x65)'),
('90dfa (45 x 65)'),
('5,5 x 30 nc'),
('5.5 x 30 nc')
) v(input)
10 rows affected
select *
from t cross apply
(select stuff(col1, 1, len(col1) - patindex('%[^0-9,.]%', reverse(col1) + ' ') + 1, '') as col1,
left(col2, patindex('%[^0-9,.]%', col2 + ' ') - 1) as col2
from (values (replace(left(t.input, charindex('x', t.input) - 1), ' ', ''),
replace(stuff(t.input, 1, charindex('x', t.input), ''), ' ', '')
)
) v(col1, col2)
) v
input col1 col2
20 x 88 nc. 20 88
100 x 300 nc 100 300
200x 88 nc. 200 88
5x 300 nc 5 300
ol (200x 88nc.) 200 88
ol (100x 300nc) 100 300
90dfa (45x65) 45 65
90dfa (45 x 65) 45 65
5,5 x 30 nc 5,5 30
5.5 x 30 nc 5.5 30