Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export results of a query to a set of INSERT statements?

In Oracle I have the requirement to produce a set of INSERT statements using the results of a SELECT statement. Basically the same way that Toad for Oracle will export the contents of a table to a set of Insert Statements either in a file or on the clip board. Is this possible?

The reason for this is that some of my geometric data is in WGS84 format and when I access it it needs to be British National Grid. This is not a problem in Oracle as I can simply use SDO_CS.Transform(date, srid) however in SQL Server this is not possible. My intention is to produce the INSERTS in Toad and them run them on SQL Server in order to populate the geometry column with the pre-transformed data. This means applying the transform in Oracle during the SELECT.

like image 249
CSharpened Avatar asked Oct 29 '25 09:10

CSharpened


1 Answers

I don't quite understand how you're trying to export the data from TOAD. But it should work as follows:

  1. Run your SELECT statement in a TOAD editor window.
  2. Press the right mouse button in the data grid with the result and select "Export dataset...".
  3. Choose "Insert Statements" from the first drop down.
  4. Click OK.
like image 129
Codo Avatar answered Oct 31 '25 13:10

Codo