Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002

    Unhappy Unanswered: BULK Insert big Problem!


    Ive a little problem. I want to load my test.csv - file into a MS-SQL DB named EGN. Well, everythings well with this query:

    sql = "BULK INSERT EGN FROM 'C:\inetpub\wwwroot\handy\crm\datenaufbereitung\te st.csv' With (KEEPIDENTITY,KEEPNULLS,MAXERRORS=0,FIELDTERMINATO R = ';',ROWTERMINATOR="&"'"&vbLf&"'"&") "

    My only problem is, that i need the recordsets to be sorted. means: i need it in the same order as in the csv.-file.

    my fields named:
    Date, Minuten, Art, Daten, Destination, Nummer, Rufnummer, Gebuehr

    all of them are varchar-fields...

    hmmm..any idea?!?!

    Thanks so much!


  2. #2
    Join Date
    Dec 2002
    Czech Republic

    Re: BULK Insert big Problem!

    --BULK INSERT ...
    Add option ROWS_PER_BATCH=1
    or if you can sort by columns in file
    with option ORDER ( { column [ ASC | DESC ] } [ ,...n ] )
    for more see BOL

    Why do you need it?
    If you SELECT from table, output seems to be sorted
    by clustered index or insertion order, but you can
    not be sure of this in MSSQLSERVER2K.
    You must specify ORDER BY.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts