Change Is Inevitable
  • Home
  • MySQL
    • MySQL-Articles
    • AWS RDS
    • Percona Xtradb Cluster
    • MariaDB
    • Galera Cluster
    • ProxySQL
    • MySQL-Scripts
    • MySQL tools
    • MySQL Resources
  • Tools
    • MySQL Advisor
    • MySQL Random Data Generator
    • Postgresql Random Data Generator
    • Clean Prompt
  • General
    • binary-to-decimal
    • Fermat’s Theorem
    • Review
    • Just for fun
    • Personal
  • Contact Me
    • Copyright
    • MySQL Podcast (Youtube)
    • MySQL Podcast (Spotify)
Recent Posts
  • MySQL INSTANT DDL breaks EXCHANGE PARTITION
  • How to setup and use Percona Binlog Server (PBS)
  • MySQL Major Version Upgrade Checklist – how to
  • InnoDB Flushing is simple – explained
  • MySQL Tools for Performance Tuning and Test Data Generation
Recent Comments
  • Kedar on MySQL INSTANT DDL breaks EXCHANGE PARTITION
  • Jean-François Gagné on MySQL INSTANT DDL breaks EXCHANGE PARTITION
  • Reggie on A Unique Foreign Key issue in MySQL 8.4
  • Kedar on How to fix write latency in MySQL 8.4 Upgrade
  • Kedar on How to fix write latency in MySQL 8.4 Upgrade
Home » mysqldump insert only
Change Is Inevitable

Kedar Vaijanapurkar's Blog for MySQL, technology and various subjects

  • Home
  • MySQL
    • MySQL-Articles
    • AWS RDS
    • Percona Xtradb Cluster
    • MariaDB
    • Galera Cluster
    • ProxySQL
    • MySQL-Scripts
    • MySQL tools
    • MySQL Resources
  • Tools
    • MySQL Advisor
    • MySQL Random Data Generator
    • Postgresql Random Data Generator
    • Clean Prompt
  • General
    • binary-to-decimal
    • Fermat’s Theorem
    • Review
    • Just for fun
    • Personal
  • Contact Me
    • Copyright
    • MySQL Podcast (Youtube)
    • MySQL Podcast (Spotify)

Browsing Tag

mysqldump insert only

1 post

How to generate Insert Statement in MySQL

  • Kedar
  • May 5, 2010
A lot of places I saw people asking for ways to generate Insert statements. We do have GUI Tool which can extract insert statements for us readily. Some of the…
View Post
MySQL Podcast (Youtube)
RSS feed: MySQL Podcast (Spotify) MySQL Podcast (Spotify)
  • MySQL Major Version Upgrade Checklist (Zero Downtime Strategy)
    Upgrading MySQL major versions in production is never just a version bump - it’s a carefully planned process involving compatibility checks, replication strategy, testing, and controlled cut-over.In this episode, we walk through a practical MySQL Major Version Upgrade Checklist based on real-world DBA workflows. We are covering MySQL replication as base setup for upgrade. It […]
Search:
... ...
  • MySQL INSTANT DDL breaks EXCHANGE PARTITION
  • How to setup and use Percona Binlog Server (PBS)
  • MySQL Major Version Upgrade Checklist – how to
  • InnoDB Flushing is simple – explained
  • MySQL Tools for Performance Tuning and Test Data Generation

8 responses to “How to generate Insert Statement in MySQL”

  1. thanks Avatar
    thanks
    April 16, 2012

    Thanks a ton dude…

    Reply
    1. Kedar Avatar
      Kedar
      May 16, 2012

      enjoy thanks 😉

      Reply
  2. R. Willis Avatar
    R. Willis
    January 23, 2012

    I also get the error “Create table ‘agps’ failed!
    ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 1
    CREATE TABLE `agps` ()” when trying to migrate microsoft access to Mysql on an Ubuntu 10.4 pc.
    I did not write any SQL so it must be some canned SQL script generated by ESF database migration tools kit. which is causing the error.
    I think that the user has all the necessary permissions, but it is almost impossible to tell with mysql.
    Could it be that the version of mysql running under Ubuntu has a different language to that assumed by ESF?
    I am running ESF on a windows pc accessing the access database on the linux pc on a LAN as there is no linux version as far as I know.

    Reply
  3. Kedar Avatar
    Kedar
    September 27, 2010

    Hey Mike,
    I tried the demo version!
    I’ve already tried Kettle (the open source product) and ESF Data Migration toolkit (~11K INR) which worked nicely for me.
    +Advance ETL costs (16K INR)!
    My observations.

    Reply
  4. Mike Avatar
    Mike
    September 27, 2010

    Advanced ETL Processor can generate INSERT SQL from any data source including test files

    http://www.etl-tools.com/generating-insert-statements.html

    Mike

    Reply
  5. Amit Mistry Avatar
    Amit Mistry
    June 9, 2010

    MySQL has a feature for profiling query. By default its off, but you can turn it on per MySQL session by issueing “set profiling=1” on MySQL command prompt.

    http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html

    But it has some limitation, first of all, it can be used for debugging while you are in a development mode. Second, it can not be used for query logging purpose.

    Major limitation it has is, you can also store 15 queries in MySQL profile and it can be configure upto 100 queries.

    Reply
  6. Kedar Avatar
    Kedar
    May 6, 2010

    As you’ve copied the code from above snipped it seems a problem with quotes (‘ and `). Please download file available at the end of the page and give it a try.

    Regarding not storing output in a file, just remove the section >> ” INTO OUTFILE ‘”, in_file ,”‘”);” from the query and procedure will output the result on prompt.

    Replace “set @Inserts….” line with following:

    set @Inserts=concat(“select concat(‘insert into “, in_db,”.”,tablename,” values(‘,concat_ws(‘,’,”,@Sels,”),’);’) from “, in_db,”.”,tablename,” group by “,@Whrs, “;”);

    Reply
  7. karthik Avatar
    karthik
    May 6, 2010

    Appreciate your effort. But i am getting the following error using ur SP :

    Script line: 4 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘\’”\’,ifnull(‘,column_name,’,””)’,’,\’”\’)’)) INTO @Sels f’ at line 12

    Cannot figure out the problem. And also is there any way to return the Insert statements as return value instead of writing to a text file ? I am new to MySql

    Reply
Change Is Inevitable
Designed & Developed by Code Supply Co.