0

我使用他们的 Dataloader 工具从 Salesforce 导出了一个帐户列表。输出文件是 CSV 文件。我有我希望它导入到已经创建的表。我对所有字段都使用了 nvarchar(255),但是在我不断收到截断错误之后,我更改为 nvarchar(max)。

我正在使用 SQL 导入工具,并导入一个平面文件。我将其设置为 " 用于文本限定符,并用逗号分隔。一切看起来都很好。然后,当我去导入时,几乎每个字段都出现截断错误。

我回去让它建议类型,并让它读取整个文件。

我不断收到同样的错误。

我回去并将所有内容更改为长度为 255 的 DT_STR,然后我得到以下内容而不是截断错误:

- Executing (Error)
Messages
Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "BILLINGSTREET" (86) to column "BILLINGSTREET" (636).  The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
 (SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Data Conversion 0 - 0.Outputs[Data Conversion Output].Columns[BILLINGSTREET]" failed because error code 0xC020907F occurred, and the error row disposition on "Data Conversion 0 - 0.Outputs[Data Conversion Output].Columns[BILLINGSTREET]" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
 (SQL Server Import and Export Wizard)

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Data Conversion 0 - 0" (552) failed with error code 0xC0209029 while processing input "Data Conversion Input" (553). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.  There may be error messages posted before this with more information about the failure.
 (SQL Server Import and Export Wizard)

我再次返回并将所有内容更改为流文本。它现在正在工作,但运行缓慢。之前花费不到一分钟的时间现在可能需要 2 小时。

仅供参考,我尝试将 csv 导入 Excel,但它要么切断前面的零,要么完全搞砸了解析。

4

1 回答 1

0

我最终做的是将 .csv 作为平面文件而不是 .xsl 文件导入。在高级区域中,我突出显示右侧的所有列并选择 DT_STR(255) 我拥有的几个超过 255 的字段我更改为 D_TEXT

这是一种解决方法,它不是“正确”的方法,但“正确”只是由于 Salesforce 导出中的数据错误而无法正常工作。一旦我将数据输入数据库,我就可以更轻松地进行审查,并让我能够识别出不良数据。

于 2020-07-08T17:54:21.850 回答