SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LOAD DATA INFILE - multiple tables

    Hi there

    I want to use the LOAD DATA INFILE statement, but it seems that it only works for one table. I am going to receive a text file with many fields, and I need to specify which fields need to go into which table. So with one LOAD DATA I want to insert into more than one table.

    Any suggestions?

    Oh, I am using Visual C++ with Qt

    Thanks
    Cilna

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    you will have to use LOAD DATA n times, where n is the number of tables to import. use this snippet from the mysql manual to selectively ignore columns:
    Quote Originally Posted by http://dev.mysql.com/doc/mysql/en/load-data.html
    You can also discard an input value by assigning it to a user variable and not assigning the variable to a table column:

    LOAD DATA INFILE 'file.txt'
    INTO TABLE t1
    (column1, @dummy, column2, @dummy, column3);

  3. #3
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, it works!


Bookmarks

Posting Permissions

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