title: SQL Server Stored Procedure Multiple Insert in a single table from Array
body: <p>I am using a stored procedure to insert records into a table. And do this at least 12 times in a loop to insert multiple records which is very inefficient. </p>
  
  <p>here is the procedure as CREATED </p>
  
  <pre><code> Create PROC [dbo].[SP_INSERT_G_SAMPLING]
   @GameID INT,
   @ScoreID INT
   as 
   begin
   INSERT INTO GAMESCORE (GAMEID, SCOREID) VALUES
   (@GameID, @ScoreID)
   end
  </code></pre>
  
  <p>I pass on the values ex(1,3) and loop with more values from the website.</p>
  
  <p>I want to however pass on all the values at one time like (1,3),(4,5),(8,9)</p>
  
  <p>and then alter the above procedure to receive and insert multiple rows. </p>
  
  <pre><code>ALTER PROC [dbo].[SP_INSERT_G_SAMPLING]
  @totalinsert nvarchar(Max) 
  
  INSERT INTO GAMESCORE (GAMEID, SCOREID) VALUES
  (@totalinsert)
  </code></pre>
  
  <p>with    @totalinsert being like (1,3),(4,5),(8,9) pushed from the webpage.</p>
  
  <p>any help is greatly appreciated</p>