Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Part of string Help again

$
0
0

select

replace(right('BAAU  1864175*2*201312170930*MBNP',CHARINDEX('_','BAAU  1864175*2*201312170930*MBNP')+27),'*','_')

It returns the result below

1864175_2_201312170930_MBNP

This is the result i want however I want it by subtracting the first words before the first space i.e in this case 'BAAU', the code i wrote is not actually doing this as it just adding +27 characters from the right but in some cases i have more than 27 characters after the first space, can some one please help me figure this out.

Many thanks


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>