Its not currently working... i'm wondering how i pass in multiple rows to be inserted?
currently the logic works one call and one row insert
but now i need to insert upto 10 rows with one call and efficiently as possible as it will be executed 100 times a second
can someone help me in the correct direction
C#Microsoft SQL ServerASP.NET
Last Comment
Guy Hengel [angelIII / a3]
8/22/2022 - Mon
Guy Hengel [angelIII / a3]
the answer is: it depends on what exactly the 10 rows to be inserted are referring to?
for a stored procedure, you only have 2 options:
* call the stored procedure 10 times indeed with the different values
* recode the stored procedure to split the parameter values into the x rows
Each insert will have these 3 items:
- ifkAlertId
- ifkCommonId
- iSoftwarePriority
The first 2 are refering to ID's in other tables
the 3rd one will either be a "1" "2" or "3" value
actually it will mostly be between 1 to 5 rows being inserted
but this SP will eventually be called very often (could be 100 of times a sec) - it will need to scale to this frequency at least!
I figured it would make more sense to insert all records in one go (i.e. 100 times a second instead of 500 times a second if there are 5 rows needing to be inserted on each of the 100)
for a stored procedure, you only have 2 options:
* call the stored procedure 10 times indeed with the different values
* recode the stored procedure to split the parameter values into the x rows
the 2nd option is not recommended for several reasons, but may be an option still for several scenarios, and you might get inspired by this article: https://www.experts-exchange.com/Database/Miscellaneous/A_1536-delimited-list-as-parameter-what-are-the-options.html