Export to SQL Inserts with MS SQL

jhernandezc's profile image jhernandezc posted 1 month ago in Import/Export Permalink

Version: HeidiSQL 12.13.0.7147 (64 Bit)

Summary:

When executing multiple SELECT queries and exporting each result individually to clipboard as SQL statements, the exported SQL always references the table from the first query — even when a different result grid is selected.

Steps to Reproduce:

  1. Run multiple SELECT statements in a single batch (e.g. SELECT FROM table1; SELECT FROM table2;)
  2. Select the result grid for table2
  3. Right-click → Export → "SQL INSERTs" → "Copy to clipboard"
  4. Paste the clipboard contents

Expected Behavior: The exported SQL should reference table2 in the INSERT INTO statements.

Actual Behavior: The exported SQL references table1 — regardless of which result grid is selected.

Workaround: I have to execute each SELECT individually to ensure the correct table name is used in the export.

Please login to leave a reply, or register at first.