in reply to Altering SQL code from Update to Insert
If that won't work for you, then you may want to use SQL::Parser to parse each line in the SQL file, that will turn your UPDATE statements into perl data stuctures containing the names of the table, the fields, and the values and you can use that to construct an INSERT statement where needed.
If you go the route of using regexen to read the SQL file, the complexity of that task will depend on the complexity of your string values - if any of them contain embedded single quotes, you'll need to get fancy to deal with the single-quote delimiters around the values.
|
|---|