Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Export table in mysql using sql query

Posted on 2010-08-24
4
Medium Priority
?
1,160 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:McFoxx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:McFoxx
ID: 33517060
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

0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 33517118
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.
0
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 600 total points
ID: 33517128
Okay, I am not losing my mind. If you go to Edit --> Preferences, click on SQL Editor tab of Workbench Preferences, you will see a section towards the bottom called Query Results. The first check box in this section is Limit Rows and it was checked by default on my installation with a row count of 1000 so you should see something similar.  

Uncheck the limit rows box or arbitrarily increase the 1000 to some other value.
0
 

Author Comment

by:McFoxx
ID: 33522802
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!
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question