I have a list of userIds
List<int> userIds = new List<int>();
I have code to insert them in to db.
ExecuteSQL(sql)
is my own function that abstracts out all the db specific logic
string iSql = "";
foreach(int id in userIds){
iSql = "insert into users (id) values (" + id + ")";
ExecuteSQL(iSql);
}
I want to insert all of these in one query, without having to call a loop like above, is this possible in SQL?
If so, what would the string iSql
look like?
I found Inserting multiple rows in a single SQL query?,
but that may create a large string.
Other articles i found were either other languages or just confusing as i couldn't relate them to my problem
(i can take care of parameterization later, i just need the query)