Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Bulk Insert , Ms Sql ..

Options
  • 27-05-2008 1:37pm
    #1
    Closed Accounts Posts: 1,788 ✭✭✭


    Hey ,
    is there a way to use BULK INSERT and specify the column you want the data from the file to go into ?

    I have
    CREATE TABLE tmp_table (line text)
    
    BULK INSERT tmp_table FROM 'E:\shared\DOCM\e\4707621.txt'
    WITH (ROWTERMINATOR = '|\eof' )
    
    which works ..

    but i can't specify more columns in the tmp_table
    like this won't work..
    CREATE TABLE tmp_table (line text,id int)
    
    BULK INSERT tmp_table(line) FROM 'E:\shared\DOCM\e\4707621.doc'
    WITH (ROWTERMINATOR = '|\eof' )
    


Comments

  • Registered Users Posts: 2,931 ✭✭✭Ginger


    Try using BCP instead...


  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Read the documentation on the BULK INSERT statement and look for the word FIELDTERMINATOR and/or the word FORMATFILE :)


Advertisement