I have a C# function which saves data to a SQL Server database. I concatenate strings in one string like this: "name1,name2,name3,name4" and I want to send them to the database in one time, instead of looping through them and save them one by one.
So, in SQL server it looks like that
Declare @names varchar
Set @names='name1,name2,name3,name4'
How can I split this array string and loop through it to insert each name into a different record?
I'm using SQL Server 2012.