SQL Server How to extract string after certain occurrence of the character in SQL

aiqt4smr  于 2023-03-17  发布在  其他
关注(0)|答案(1)|浏览(152)

I have a string as shown here, and I would like to extract 1234566@2345|1234544@3456 from that string.

1111,AAA,9087404,20230315,VVBBFDEe,1234566@2345|1234544@3456,FALSE,,,,,

With CHARINDEX I can only look for the first comma.

wbgh16ku

wbgh16ku1#

thank you @JNevill. All that i did is and got the output i was looking for.

select [value]
from (select '1111,AAA,9087404,20230315,VVBBFDEe,1234566@2345|1234544@3456,FALSE,,,,,' as string ) a
CROSS APPLY STRING_SPLIT(a.string,',')
where [value] like '%@%|%@%'

相关问题