#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0

    Loading files automation using Load_data


    HI everyone,

    I want to load more than 100 CSV files in every week to database. For the same i am using LOAD DATA functionality of MYSQL.

    To automate it. I am extracting file name & related path in csv file using scripting & loading to the table. Now i have all csv files names & path in my database table.

    I tried to create a prepared statement for LOAD DATA, where i was concatenating file name & file path to LOAD DATA statement in procedure using cursor to dynamically execute it.

    But here LOAD DATA is not allowed in procedures.

    Can anyone please help me to do so????

    Please suggest.

    Thanking you in advance.

    Regards,
    Dhiraj
  2. #2
  3. No Profile Picture
    Problem Solver
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2001
    Location
    Stockholm, Sweden
    Posts
    4,495
    Rep Power
    534
    Don't use a stored procedure, write it in an script language outside MySQL instead that sends the LOAD DATA statements into the mysql server instead.
    /Stefan
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    2
    Rep Power
    0
    Originally Posted by sr
    Don't use a stored procedure, write it in an script language outside MySQL instead that sends the LOAD DATA statements into the mysql server instead.
    Hello Sir,

    Thanking you for your reply. My next question is can we use Load data in prepared statement. If not then please suggest alternative.

    Thanking you.

    Regards,
    Dhiraj

IMN logo majestic logo threadwatch logo seochat tools logo