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

  • 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

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2