title: Trying to insert a 2D array into sql server database using node.js
body: <p>I have a node app that takes responses from a form and is inserting them into a database. The table is laid out a bit weird so my current solution of using a <code>for</code> loop to iterate over each item and submit may be the best route. However, I had a thought that maybe I could just insert a 2D array into SQL Server. </p>
  
  <p>The html form is populated by pulling for questions from a database that holds all of the questions. because questions can be added and removed at any point each question and response gets its row in the table instead of feeding to a column. </p>
  
  <p>Here is how the form is set up:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form action="{{ route('ScorecardController.create') }}" method="POST"&gt;
      {{ csrfField() }}
      @each(question in questions)
          @if(question.Group == 'Y')
            &lt;h3&gt; {{ question.Questions }}&lt;/h3&gt;
          @else
            &lt;label for="{{ questions.QuestionsKey }}"&gt; {{question.Questions }}&lt;/label&gt;
            &lt;select type="text" name="{{ question.QuestionsKey }}"&gt;
              &lt;option value="-/-/na"&gt;NA&lt;/option&gt;
              &lt;option value="{{ question.PointValue }}/{{ question.PointValue }}/yes"&gt;Yes&lt;/option&gt;
              &lt;option value="0/{{ question.PointValue }}/no"&gt;No&lt;/option&gt;
            &lt;/select&gt;
            &lt;br /&gt;
  
          @endif
      @endeach
  
      &lt;button type='submit'&gt;Submit&lt;/button&gt;
  
    &lt;/form&gt;
  </code></pre>
  
  <p>Once submit is hit some other queries run to gather missing info I need in order to push to the database. Finally I have to loop over each result and submit individually.</p>
  
  <pre><code>for(var key in QCAnswers) {
             let answerSplit = QCAnswers[key].split('/')
  
             const posted = await SalesAnswer.create({
                 id: newScoreIDValue,
                 ScorecardKey: scorecardIDValue,
                 QuestionsKey: key,
                 Answer: answerSplit[2],
                 PointValue: answerSplit[1],
                 EarnedPoints: answerSplit[0],
                 EmployeeScored: employeeScored,
                 ScoredBy: scoredBy,
  
             })
         }
  </code></pre>
  
  <p>Ideally instead of having to do the <code>for</code> loop I could just push the array and be done with it.</p>