What is IMEX within OLEDB connection strings?

Dimitar Tsonev picture Dimitar Tsonev · Apr 11, 2012 · Viewed 75.3k times · Source

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=localhost;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=2"

What is the purpose of IMEX=2 in the above connection string?

Answer

Steve picture Steve · Apr 11, 2012

From ConnectionStrings

"If you want to read the column headers into the result set (using HDR=NO even though there is a header) and the column data is numeric, use IMEX=1 to avoid crash.

To always use IMEX=1 is a safer way to retrieve data for mixed data columns. .."

Please note that the IMEX value can be very important when you need to write back data to the Excel. A fast search on Internet on IMEX found numerous articles about problems with various IMEX values