Home Forums SQL Server 2008 T-SQL (SS2K8) Using DelimitedSplit8k against a Space Delimited Field - Problems RE: Using DelimitedSplit8k against a Space Delimited Field - Problems

  • Luis Cazares (7/24/2013)


    You might have a character that might not be a space.

    You can check which character is with this code (it's untested, but it should work).

    WITH E1(N) AS (

    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL

    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL

    SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1 UNION ALL SELECT 1

    ), --10E+1 or 10 rows

    E2(N) AS (SELECT 1 FROM E1 a, E1 b), --10E+2 or 100 rows

    cteTally(N) AS (

    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM E2

    )

    SELECT SUBSTRING(ResultsText, N, 1), ASCII(SUBSTRING(ResultsText, N, 1))

    FROM SampleData

    CROSS JOIN cteTally

    ORDER BY ResultsText, N

    States that it is a line feed - ASCII 10.

    I tried this:

    Select sd.CoreID, sd.ComputerID, sd.ResultsText

    From SampleData sd

    cross apply dbo.DelimitedSplit8k(sd.ResultsText, ascii(10))

    Still is a no go. Get's the same result as I previously did.