sql - Concatenate & Trim String -
can me, have problem regarding on how can below result of data. refer below sample data. logic first want delete letters before number , if same thing goes on , delete numbers before letter can desired result.
table:
salv3000640pix32blu salv3334470a9carbongry tp3000620pixl128blk desired output:
pix32blu a9carbongry pixl128blk
you need use combination of substring , patindex functions
select substring(substring(fielda,patindex('%[^a-z]%',fielda),99),patindex('%[^0-9]%',substring(fielda,patindex('%[^a-z]%',fielda),99)),99) youroutput yourtable input
yourtable
fielda salv3000640pix32blu salv3334470a9carbongry tp3000620pixl128blk output
youroutput pix32blu a9carbongry pixl128blk sql fiddle:http://sqlfiddle.com/#!6/5722b6/29/0
Comments
Post a Comment