Link to home
Start Free TrialLog in
Avatar of McFoxx
McFoxx

asked on

Export table in mysql using sql query

Hello,

I am using MySQL Workbench 5.2 OSS to view and when necessary, remove records from a table via SQL Statements.

I am trying to run the statement below to export all records from a table named master_rate_records as a text file with the same name, but it is telling me there is an error in my SQL syntax (error code 1604).

I've tried to reword it a few times with no luck. I figured it was time to ask the experts.

Thanks in advance!
SELECT * FROM master_rate_records
  INTO OUTFILE 'master_rate_records.txt'
          FIELDS TERMINATED BY ','
          ENCLOSED BY '"'
          LINES TERMINATED BY '\n'

Open in new window

Avatar of McFoxx
McFoxx

ASKER

I tried the following and it was able to export a file.... however I was expecting something arounf the range of 100MB, I only got a 70K file with only the first 1000 lines. Is this some sort of limit I can bypass?

Thanks in advance!
SELECT *
INTO OUTFILE 'C:\\master_rate_records.txt'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM master_rate_records

Open in new window

Avatar of Kevin Cross
None that I know of (limits on OUTFILE), but I did notice after loading the new Workbench there is a limit to the rows returned ... let me see if I can track down where to change it.
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of McFoxx

ASKER

mwvisa1, thanks a ton!

It worked, the query has been running for a few minutes now, so I know it's doing it's thing.

Thanks for your help!