> On 1 Aug 2015, at 2:09am, Bernardo Sulzbach <mafagafogigante at gmail.com>
> wrote:
>
>> =CONCATENATE("INSERT INTO myTable VALUES (",a1,","a2");")
>
> This is so neat. Supposing you are not migrating from a spreadsheet
> because it got too big (millions of rows will take a time for this to
> finish) and that your data respects a logical grouping, this is very
> handy.
Glad you like it. I stumbled on it when I had a spreadsheet where lots of
columns needed a little more processing before they were suitable for a .csv
file. There was one particularly annoying text field which contained
line-ends, apostrophes and quotes and I couldn't get it to work right in the
.csv export/import. I eventually realised that instead of making a .csv file I
could make a .sql file with the IMPORT commands in. Make a column of
CONCATENATE formulae as above, select and copy the column of results and paste
them into a text file, and I was done.
I missed out two commas in the example I posted above. It should be more like
=CONCATENATE("INSERT INTO myTable VALUES (",a1,",",a2,");")
Simon.