我有一个ProductDetails列,其中包含
等值j Jameson Mbc 6.5, abc 8 abc blah
Napa california Mbc 1 abc 3.5
Washington k Mbc 2.5 abc 6
New york city is awesome
我有数千条记录
我想填充其他2列Mbc和abc,如下所示
Mbc
6.5
1
2.5
abc
8
3.5
6
我尝试了(DT_STR,10,1252)substring(ProductDetails, findstring(“Mbc”, ProductDetails,1)+4,3)
对于abc = (DT_STR,10,1252)substring(ProductDetails, findstring(“abc”, ProductDetails,1)+4,3)
我得到了结果,有些值会以1C
或2b
等形式出现,只是想要数字没有字符
对于列值,例如
New york city is awesome
我们只想填充Null
等
由于
答案 0 :(得分:2)
“abc”专栏
FINDSTRING( [ProductDetails],"abc", 1 ) > 0 ? SUBSTRING(SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"abc", 1 ) + 4 , 3),1,LEN( SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"abc", 1 ) + 4 , 3) ) - FINDSTRING( SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"abc", 1 ) + 4 , 3) ," ",1)) : NULL(DT_WSTR,50)
“Mbc”专栏
FINDSTRING( [ProductDetails],"Mbc", 1 ) > 0 ? SUBSTRING(SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"Mbc", 1 ) + 4 , 3),1,LEN( SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"Mbc", 1 ) + 4 , 3) ) - FINDSTRING( SUBSTRING([ProductDetails], FINDSTRING( [ProductDetails],"Mbc", 1 ) + 4 , 3) ," ",1)) : NULL(DT_WSTR,50)