Results 1 to 5 of 5

Thread: Inserting a text flie into sql

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    13

    Inserting a text flie into sql

    Hi guys im running vb 2008 express edition what im trying to do
    a bulk insert into sql table,how would i go about doing this.
    The file im trying to load is a text file that has a name and number so it would be to columns.

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Inserting a text flie into sql

    I'm not quite sure how would you go an insert a txt file.I thought you were looking to insert the text file in SQL and not it's columns but i think you want the columns inserted since you said bulk.
    if you file isn't formatted somehow then i'm not sure how would you know where the columns begin and end.You could try to make it a CSS file.Anyhow have a look at the bulk insert.
    http://msdn.microsoft.com/en-us/library/ms188365.aspx
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    13

    Re: Inserting a text flie into sql

    This is the sql statement im trying to use
    BULK INSERT table5 FROM 'C:\Users\willi\Desktop\plays.txt' WITH (FIELDTERMINATOR='\t',ROWTERMINATOR=' ' )

    like i said im using visual basic 2008 express and sql 2005 express

    Im getting this error


  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2010
    Posts
    13

    Re: Inserting a text flie into sql

    Can anyone help with this thanks will

  5. #5
    Hyperactive Member
    Join Date
    Jul 2010
    Location
    UK
    Posts
    288

    Re: Inserting a text flie into sql

    This is the issue I had that I managed to resolve. Check out this thread http://www.vbforums.com/showthread.php?t=626932

    The solution I found I copied the code there. There are other comments you may find useful.
    Good luck.

Posting Permissions

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



Click Here to Expand Forum to Full Width