Hello
I have trawled the internet and this site and tried (unsucessfully) to split the pipe delimited field that I have into separate fields.
So far, thanks to some code that I found on google, I have managed to get the last 2 values, and can get the first, It is just all the bits in the middle that I seem to be getting stuck with.
I am using a SQL Server 2008 database and would, ideally, like this to be a Universe solution rather than using substring and Pos in the report itself.
Here is what I have so far:
select
RIGHT([DESCRIPTION], Nullif(CHARINDEX('|', REVERSE([DESCRIPTION]))-1, - 1) ) as 'Last',
RIGHT(
LEFT([DESCRIPTION], LEN([DESCRIPTION]) -
CHARINDEX('|', REVERSE([DESCRIPTION]))),
CHARINDEX('|', REVERSE(LEFT([DESCRIPTION], LEN([DESCRIPTION]) - CHARINDEX('|', REVERSE([DESCRIPTION])))
)) - 1
) as 'Penultimate'
From FINENTRYFACT
Where FINENTRYFACTID = 1
There are Nine values and, unfortunately, each value is of differing lengths.
What I really need is for someone to show me how to get the 1st, 2nd, 3rd values and then I will be able to see where I am going wrong (I can’t seem to get the Position of the last delimiter in order to start from there for the next column).
I hope that someone can help as this has driven me to distraction this weekend!
Many thanks in advance to anyone that can help.
Jubs
jubline (BOB member since 2010-02-11)