Help with SubString in SSIS

不打扰是莪最后的温柔 提交于 2019-11-28 13:19:32

问题


Hallo All,

I have a little Problem with the SubString-Function in SSIS (Derived Column).

So on..
That are the possible Input Strings:

Toys|Category|Cars|Lego

Toys|Hot&New|Girls&Lifestyle|Doll

Toys|New

Barbies|Category|Mobile

I need to filter the word after the Second " | ".

In first case: "Cars"

In the second case: "Girls&Lifestyle"

In the third case: ""

In the fourth case: "Mobile"

My try was: SUBSTRING(Category,FINDSTRING(Category,"|",2)+1,FINDSTRING(Category,"|",3))

It doesn't work because the FINDSTRING(Category,"|",3) gives the index but I need the lenght of the Word!! How can i count the Characters of a word in a String?

Thank you for your Help and Sorry for my bad english!!

Best Regards Alex


回答1:


This should do what you want...a touch messy though!

SUBSTRING( Category, FINDSTRING( Category, "|", 2 )+1,FINDSTRING( Category, "|", 3 )-FINDSTRING( Category, "|", 2 )-1)


来源:https://stackoverflow.com/questions/5324590/help-with-substring-in-ssis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!