• murthyvs (12/11/2012)


    Thanks Cadavre. This is cool stuff.

    Can your code take two row terminators? pipe (|) and line break ()?

    Example data:

    field1;field2|

    30;38469|

    31;38469|

    32;38469|

    33;38469|

    34;38469|

    I didn't notice the line break in the original data. Very sorry.

    The intent is that my user copies example data from excel and enters into a multiline text box in a webpage. He then hits a button that would transfer the input string (example data) to a stored proc that reads the data and splits into multiple column - multiple rows.

    Thanks for all your help.

    Why not just remove the line breaks?

    DECLARE @exampleData VARCHAR(8000) = '30;38469|

    31;38469|

    32;38469|

    33;38469|

    34;38469|';

    SET @exampleData = REPLACE(REPLACE(@exampleData,CHAR(13),''),CHAR(10),'');

    EXECUTE SSC_Multi_Split @exampleData,'|',';'


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/