27

When you run a query (a SELECT statement) in the console, the data retrieved from the database are shown in table format in the Result pane of the Database Console tool window.

I've searched through datagrip Help and I'm just wondering if there is anyway out there that can be used to generate INSERT INTO scripts for a tables' content or rows in table format?

Oxobo
  • 513
  • 1
  • 5
  • 13

1 Answers1

54

Choose SQL Insert extractor in the drop-down menu.

enter image description here

Them you'll be able to copy (Ctrl/Cmd+C) data as a bunch of INSERTS. Or use Export button next to the extractor.

enter image description here

moscas
  • 9,064
  • 36
  • 42
  • than you, can I generate insert for one (or some) of the rows in the Result pane (table format) or I must specify that row in where clause? – Oxobo Jun 23 '18 at 06:46
  • 1
    Yes you can, just select this row and press Copy. Only this row will be generated. – moscas Jun 28 '18 at 08:32
  • 2
    Note if you don't see a "SQL Inserts" button, click on the drop down to the left of the "download" button , and then you can choose "SQL Inserts". Mine was defaulted to something else originally... – Brad Parks Aug 08 '19 at 14:37
  • What to do if table name have database name automatically added in insert, i don't want it? – Augustas Aug 19 '19 at 12:32
  • Try using SQL Insert the groovy extractor, it can be customized. – moscas Sep 03 '19 at 10:05
  • For those who are trying to find a way to do batch inserts, this should work: https://gist.github.com/ProjectCleverWeb/d2362b082af1d7054ebfd464f202ec1b – Nicholas Summers Aug 11 '20 at 16:35