title: Generate insert SQL statements from a CSV file
body: <p>I need to import a csv file into <strong>Firebird</strong> and I've spent a couple of hours trying out some tools and none fit my needs.</p>
  
  <p>The main problem is that all the tools I've been trying like <a href="http://www.sqlmanager.net/products/ibfb/dataimport" rel="noreferrer">EMS Data Import</a> and <a href="http://www.sqlmaestro.com/products/firebird/datawizard/help/06_01_05_csv/" rel="noreferrer">Firebird Data Wizard</a> expect that my CSV file contains all the information needed by my Table.</p>
  
  <p>I need to write some custom SQL in the insert statement, for example, I have a CSV file with the city name, but as my database already has all the cities in another table (normalized), I need to write a subselect in the insert statement to lookup for the city and write its ID, also I have a stored procedure to cread GUIDS.</p>
  
  <p>My insert statement would be something like this:</p>
  
  <pre><code>INSERT INTO PERSON (ID, NAME, CITY_ID) VALUES((SELECT NEW_GUID FROM CREATE_GUID), :NAME, (SELECT CITY_ID FROM CITY WHERE NAME = :CITY_NAME)
  </code></pre>
  
  <p>How can I approach this?</p>