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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Bulk Insert , Ms Sql ..

  • 27-05-2008 12: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, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Try using BCP instead...


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


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


Advertisement