String concatenation, Excel way: "string1" & "string2".
Today I had to write a SQL script based on data from an Excel file. The file had about 670 rows which in the resulting script should become 670 lines like this one:
insert into sample_table (value1, value2) values (value_from_cell_B2, value_from_cell_C2)
I added a new column to the spreadsheet for SQL statement, wrote following formula and applied it for each row.
insert into sample_table (value1, value2) values ('"&B2&"', '"&C2&"')
Then I copied all cells from the SQL column to the script file. Done.
Today I had to write a SQL script based on data from an Excel file. The file had about 670 rows which in the resulting script should become 670 lines like this one:
insert into sample_table (value1, value2) values (value_from_cell_B2, value_from_cell_C2)
I added a new column to the spreadsheet for SQL statement, wrote following formula and applied it for each row.
insert into sample_table (value1, value2) values ('"&B2&"', '"&C2&"')
Then I copied all cells from the SQL column to the script file. Done.
No comments:
Post a Comment