Referencing an outside file through SQL

Sharky Forums


Results 1 to 1 of 1

Thread: Referencing an outside file through SQL

  1. #1
    Gibson Les Paul Shark RPG Junkie's Avatar
    Join Date
    Nov 2000
    Posts
    5,680

    Referencing an outside file through SQL

    Ok guys, I got a problem using MySQL to reference an outside file through an SQL script...I get an error saying that it cannot find the files themselves. The idea of this script is to point to other files that are in another directory and to use them as population scripts for the tables...

    Here is the script I have. Yes it is one I downloaded and I'm using as an example so I can get more familiar with MySQL and phpMyAdmin and PHP...

    So yeah, I don't see the problem...and I'm not getting much luck with teh almighty Google...

    LOAD DATA LOCAL INFILE '.\\datafiles\\customers.txt' INTO TABLE Customers
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\employees.txt' INTO TABLE Employees
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\offices.txt' INTO TABLE Offices
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\orderdetails.txt' INTO TABLE OrderDetails
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\orders.txt' INTO TABLE Orders
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\payments.txt' INTO TABLE Payments
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\products.txt' INTO TABLE Products
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';

    SHOW WARNINGS LIMIT 10;

    LOAD DATA LOCAL INFILE '.\\datafiles\\ProductLines.txt' INTO TABLE ProductLines
    FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
    (productLine , textDescription);

    SHOW WARNINGS LIMIT 10;
    Last edited by RPG Junkie; 10-16-2007 at 01:24 AM.

Posting Permissions

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