SqlBulkCopy is supposed to help do large volume of inserts instead of sending individual insert statements. But what about calling stored procedures? I have a procedure that the data gets passed to it and then it does some lookups in another table and possibly a second insert into that lookup table.
Since this can’t be converted to a query, is there a way to use SqlBulkCopy for stored procedure calls or would it not make any sense?
I’m only making 2000 or less calls at a time per db connection but wanted to know if there was a more efficient way.
Based on @Kev answer, you can do the bulk insert into a staging table and then you can have a trigger kick off your stored procedure.
I’m assuming you have a FK constraint to your other table so you’ll need the value before inserting into the target table. You might try removing the constraint if possible. Do your bulk insert then the trigger can just update the columns afterward.