Sometimes you need to build bulk query to select, update or insert data to SQL tables. The selected, updated or inserted data is dynamic and is selected based on data in many tables.
An example of this is the following requirement:
Note that the number of Insert SQL statements needed can be high based on the initial condition.
To achieve this requirement, there are three options:
Generally, each of these methods has its pros and cons so there is no solution that fits all; however, SQL Queries usually gives the best performance with medium complexity.
In my next post, I’ll give some examples on the use of SQL Queries to create queries to insert/update/delete to demonstrate its power in achieving many such scenarios.