(or not be overwritten with NULL values with the new generated statement) You want the columns which are not updated to keep the same value
Generate update statement in excel where the columns that can be updated are dynamic
="insert into customers values('" &B3 &"','" & C3 & "','"&D3&"') " where B3, C3, D3 refer to above table data. For the above tabular structure, the concatenate formula would look like: Once the data is ready it is very easy to generate the SQL queries using excel string addition operator – &. Using excel operator ‘&’ to generate SQL query Often you may have to use lookup formulas to clean up the raw data imported in CSV formats. Have your data readyįor our purpose the data is arranged like this:Īs you can see, the data has to be in a tabular format so that you can easily generate the query statements. But you can easily extend this technique to come up with complex query statements. The example below shows a simple insert statement generated from customer data in a table. Here is a tutorial if you ever have to use excel to generate SQL statements. I have used excel plenty of times to generate SQL insert / update statements which I could later execute on the database console.
Often when you are working on 2 incompatible systems and try to import data from one to another, excel can be a handy tool.