title: SQL server--> Inserting multiple rows into a table with identity column
body: <p>I wanna insert a multiple rows into a table with identity column</p>
  
  <p>I have a table called <code>'STU'</code> with the following columns:</p>
  
  <ul>
  <li>SNO (Primary Key, and Identity [i.e. autoincrementing])</li>
  <li>NAME (not null)</li>
  <li>CLASS (not null)</li>
  <li><p>SECTION (not null)</p>
  
  <p><code>CREATE TABLE STU (SNO INT IDENTITY (1,1) CONSTRAINT PK_SNO PRIMARY KEY (SNO), 
   NAME VARCHAR(25), CLASS VARCHAR(20), SECTION CHAR );</code></p></li>
  </ul>
  
  <p>The values are got inserted while executing insert query for each row individually </p>
  
  <pre><code>INSERT INTO STU VALUES('A','1','A');
  INSERT INTO STU VALUES('B','2','B');
  INSERT INTO STU VALUES('C','3','C');
  INSERT INTO STU VALUES('D','4','D');
  INSERT INTO STU VALUES('E','5','E');
  </code></pre>
  
  <p>but while trying to insert multiple values using single insert query in every possible shots, it took throws an error</p>
  
  <pre><code> INSERT INTO STU (SNO,NAME,CLASS,SECTION) 
   VALUES(NULL,NULL,NULL,NULL)
   ,('A','B','C','D','E','F')
   ,('1','2','3','4','5','6')
   ,('A','B','C','D','E','F');
  </code></pre>
  
  <p>also</p>
  
  <pre><code>INSERT INTO STU (NAME,CLASS,SECTION) VALUES 
  ('A','B','C','D','E','F'),
  ('1','2','3','4','5','6'),
  ('A','B','C','D','E','F');
  </code></pre>
  
  <p>also</p>
  
  <pre><code>INSERT INTO STU (NAME,CLASS,SECTION) VALUES 
  ('A','1','A'), 
  ('B','2','A'),('C','3','A'), 
  ('D','4','D'),
  ('E','5','E'),
  ('F','6','F');
  </code></pre>
  
  <p>also</p>
  
  <pre><code>  INSERT INTO STU (SNO,NAME,CLASS,SECTION) VALUES 
   (NULL,'A','1','A'), 
   (NULL,'B','2','A'),
   (NULL,'C','3','A'), 
   (NULL,'D','4','D'),
   (NULL,'E','5','E'),
   (NULL,'F','6','F');
  </code></pre>