rottenapple

博客园 首页 新随笔 联系 订阅 管理

From http://microsoftdw.blogspot.com/, good blog for SSIS

So sometimes you have data that does not come up right in Excel because either it's not formatted, or it's got mixed types. The end of it all is you just need it to come in as text and you can convert it later. My good friend, Robert Skoglund gave me this hint and I dug up some info on it....


Basically, add the option IMEX=1 to the ConnectionString for Excel. This forces the columns to be treated all as text.

This from ConnectionStrings.com....

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:"MyExcel.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
"HDR=Yes;" indicates that the first row contains columnnames, not data
"IMEX=1;" tells the driver to always read "intermixed" data columns as text
TIP! SQL syntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a "$" and wrapped in "[" "]" brackets.



From Microsoft.....
http://msdn2.microsoft.com/en-us/library/ms254500.aspx

Credit, where credit is due....

http://www.dicks-blog.com/archives/2004/06/03/external-data-mixed-data-types/


posted on 2009-01-13 09:42  rottenapple  阅读(286)  评论(0编辑  收藏  举报