So I am trying to split some data into different columns from a pipe delimited row, this is the row: Row
I have a function that works for it which is the following:
CREATE FUNCTION dbo.TestPipeSplit
(
  @multiwordstring VARCHAR(255),
  @wordnumber      NUMERIC
)
returns VARCHAR(255)
AS
  BEGIN
  DECLARE @remainingstring VARCHAR(255)
  SET @remainingstring=@multiwordstring
  DECLARE @numberofwords NUMERIC
  SET @numberofwords=(LEN(@remainingstring) - LEN(REPLACE(@remainingstring, '|', '')) + 1)
  DECLARE @word VARCHAR(50)
  DECLARE @parsedwords TABLE
  (
     line NUMERIC IDENTITY(1, 1),
     word VARCHAR(255)
  )
  WHILE @numberofwords > 1
    BEGIN
        SET @word=LEFT(@remainingstring, CHARINDEX('|', @remainingstring) - 1)
        INSERT INTO @parsedwords(word)
        SELECT @word
        SET @remainingstring= REPLACE(@remainingstring, Concat(@word, '|'), '')
        SET @numberofwords=(LEN(@remainingstring) - LEN(REPLACE(@remainingstring, '|', '')) + 1)
        IF @numberofwords = 1
          BREAK
        ELSE
          CONTINUE
    END
As you can see on the screenshot, there is a yellow highlight, I need to be able to also separate these rows by dash. So the tool I'm using imports data into SQL, every dash separated item is a piece of user info, I need to be able to separate every user (dash) and then separate the pipe delimited pieces of info into different columns. I was able to do the second part but I'm stuck with the dashes. I tried to apply the same function for the pipes to the dashes but I've left the script running for more than an hour and nothing comes up.
Thank you !!!