title: Importing a bit type from an Excel spreadsheet into SQL Server
body: <p>I have a spreadsheet, and one of the columns is IsActive, and all the values are 1 (number data type in Excel). In SQL Server, the table its being inserted into has a bit data type for IsActive. However, the error that I get when trying to insert the data is </p>
  
  <pre><code>The given value of type String from the data source cannot be converted to type bit of the specified target column.
  </code></pre>
  
  <p>Is there a data type in Excel that will be compatible with a bit in SQL Server?</p>
  
  <pre><code> excelConnection.Open();
                      using (OleDbDataReader dReader = cmd.ExecuteReader())
                      {
                          using (SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection))
                          {
                              //Give your Destination table name 
                              sqlBulk.DestinationTableName = "Medicine";
                              sqlBulk.WriteToServer(dReader);
                          }
                      }
  </code></pre>
  
  <p>EDIT: Here's the OleDB command</p>
  
  <pre><code> using (OleDbCommand cmd = new OleDbCommand("Select ...[IsActive]... from [Sheet1$]", excelConnection)
  </code></pre>
  
  <p>I obviously don't want the string IsActive to be inserted into a bit column.</p>