数据类型错误(nvarchar而不是ntext)

时间:2012-11-19 10:55:35

标签: sql sql-server-2008 excel ssis

我使用SSIS将数据从excel(.xls)导入SQL Server 2008。我在excel连接管理器的连接字符串中包含了IMEX=1。但是一列包含如下值:

4-Hour Engineer Dispatch ASPP Engr Dispatch 1: Up to 1 dispatch (8 hours) per year.  Hours exceeding allocation billed @ 1.5x hourly rate w/ 8-hr min Engr Dispatch:  8-hrs to arrive on-site from Ciena's determination of need  On-Site Engineer Dispatch - 8 Hour ASPP Engr Dispatch 8: Up to 8 dispatch (64 hours) per year.  Hours exceeding allocation billed @ 1.5x hourly rate w/ 8-hr min Engr Dispatch:  NBD to dispatch from Ciena's determination of need Per Incident On Site Support ASPP Engr Dispatch 12: Up to 12 dispatch (96 hours) per year.  Hours exceeding allocation billed @ 1.5x hourly rate w/ 8-hr min Engr Dispatch:  Next day to arrive on-site from Ciena's determination of need  Resident Engineer Engr Dispatch:  2-hrs to arrive on-site from Ciena's determination of need Engr Dispatch:  4-hrs to arrive on-site from Ciena's determination of need ASPP Engr Dispatch 2: Up to 2 dispatch (16 hours) per year.  Hours exceeding allocation billed @ 1.5x hourly rate w/ 8-hr min N

实际上,Excel文件中大约有600行。但是上述值仅在450行之后出现。因此,该列的数据类型默认为nvarchar(255),而不是ntext,因此我收到错误。

任何人都请帮忙......提前致谢...

2 个答案:

答案 0 :(得分:0)

在SSIS中使用Excel源和OLE DB目标之间的基本数据流转换\数据转换

Example

答案 1 :(得分:0)

Excel默认使用前8行来确定数据类型。

您可以在注册表中增加抽样大小(http://ddkonline.blogspot.ca/2008/05/ssis-excel-data-source-error-text-was.html)

请注意,似乎这个键并不总是位于那里。在我的机器上,它位于HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Access Connectivity Engine\Engines\Excel

您可以在注册表中搜索TypeGuessRows