title: Insert many values in SQL Server table
body: <p>I don't know but it may be no sense question to many of you, but I was asked in an interview and I really got confused as I have just started working on SQL Server. If I have hundreds of fields to be inserted into a SQL Server database in a single step, do I need to write every column name in my SQL command.</p>
  
  <pre><code>INSERT into Database(field1, field2,...field100) VALUES(val1, val2,...val3)
  </code></pre>
  
  <p>I am getting these values from textboxes and comboboxes and similar controls. Is it the only way to do this or is there a easy way of doing this? I don't have a great knowledge of SQL Server. I am trying to learn it. I am using C# 4.0, SQL Server 2008 Express.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Let me explain the Interveiw Question.
  To be precise, they asked me that, they had a form to filled in by a user (in winforms). That form was divided into multiple Tab Pages(5-6) in a Tab Control. Now they wanted to feed the data in the database by a single click means, they did not want to send the data page by page. Rather they wanted to feed the data by a single click of a button. Either complete data or none.</p>
  
  <p>What I answered is, I will do it through transaction. For clarity i will frame an Insert command for every page and Execute them in a transaction. If succeed Commit otherwise rollback. </p>
  
  <p>But the immediate reply was, "Transaction is fine, but will you write all the textboxes value in insert command?"</p>
  
  <p>I said if something is null I will ignore, but all the time values can not be null as different users will be filling the form in a different way. So it is better to include all textboxes value (or sql parameters) in our SQL Command.</p>
  
  <p>But the question was again same, "Will you be writing all the textboxes values if at all they count to 100s or 200s?"</p>
  
  <p>With a confused mind, my answer was "yes".</p>
  
  <p>And they did not look satisfy.</p>
  
  <p>That's the reason I asked in 1 comment. Can it be done with a list. I mean, if I have all the controls added into a list, can we use that list in anyway? But now I feel, we can not.</p>
  
  <p>And ya they kicked me out of the selected candidate list :-)) LOL, never  mind.</p>