Home Forums SQL Server 2008 T-SQL (SS2K8) An alternative to split for performance benefits? RE: An alternative to split for performance benefits?

  • I'm actually looking at the bulk insert technique now - in terms of data it's very simple, an Excel file with an email address per row, saved as a CSV, that's literally all.

    The bulk insert I'm trying keeps appending them all into one column rather than multiple rows though which is a bit annoying!

    IF object_id('tempdb..#EmailAddresses') IS NOT NULL

    BEGIN

    DROP TABLE #EmailAddresses

    END

    CREATE TABLE #EmailAddresses(

    Email Varchar(max) NOT NULL

    ) ON [PRIMARY]

    BULK INSERT #EmailAddresses

    FROM 'C:\Program Files\Microsoft SQL Server\Book1.csv'

    WITH

    (

    FIELDTERMINATOR = ',',

    ROWTERMINATOR = ''

    )

    And that just spits out email addresses with a space between e.g. x@x.com y@y.com....

    I tried with 0x0a as the rowterminator instead but it generated the same results, I need to play some more with this (I've only used it once before a v long time ago!)