title: Importing excel file to SQL database, how to ignore 2nd row; asp.net & C#
body: <p>I'm importing data in a SQL Server 2008 database from excel file where the first row is headers (HDR=1). The thing is that the second row is also kind of headers which i don't really need to be imported. So how do I ignore the second row from that excel (I guess if the first row is the headers, the actual second row in excel is first)? </p>
  
  <p>In MySQL is just about saying IGNORE LINES 1 in the end of import command ... How do I do it in SQL Server? </p>
  
  <p>Here is part of the code doing that:</p>
  
  <pre><code> //Create Connection to Excel work book
              OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
  
  
              //Create OleDbCommand to fetch data from Excel
              OleDbCommand cmd = new OleDbCommand("Select [task_code],[status_code],[wbs] from [task$]", excelConnection);
  
              excelConnection.Open();
              OleDbDataReader dReader;
              dReader = cmd.ExecuteReader();
              SqlBulkCopy sqlBulk = new SqlBulkCopy(connectionString);
              //Give your Destination table name
              sqlBulk.DestinationTableName = "task";
              sqlBulk.WriteToServer(dReader);
              sqlBulk.Close();
  </code></pre>
  
  <p>Thanks </p>