【问题标题】:SQL Import wizard unable to map tinyintSQL 导入向导无法映射 tinyint
【发布时间】:2012-02-28 12:16:41
【问题描述】:

我在SQL Server 2008 R2中创建了一个名为test2的表,如下所示

标识 ||用户名 ||时间

tinyint uniqueidentifier time(7)

我创建了一个.csv 文件,如下所示,其中包含一行

标识 ||用户名 ||时间(7)

1 b64d51a8-852f-40ea-ab4c-080df747214b 00:00:00

现在,我正在使用 SQL 导入向导将此行插入到我的数据库表中。

在选择以下映射时(见下文)我收到此错误:

  Executing (Error)
  Messages
  Error 0xc02020a1: Data Flow Task 1: Data conversion failed. The data conversion for column  "Column 0" 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 "output column "Column 0" (10)" failed because error code 0xC0209084 occurred, and the error row       disposition on "output column "Column 0" (10)" 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 0xc0202092: Data Flow Task 1: An error occurred while processing file    
  "C:\Users\parth\Documents\test2.csv" on data row 1.
  (SQL Server Import and Export Wizard)

   Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  
   The PrimeOutput method on component "Source - test2_csv" (1) returned error code 0xC0202092.  
   The component returned a failure code when the pipeline engine called PrimeOutput(). 
   The meaning of the failure code is defined by the component, but the error is fatal and the
   pipeline stopped executing. 
   There may be error messages posted before this with more information about the failure.
   (SQL Server Import and Export Wizard)

映射:

id(tinyint) -> SSIS 单字节无符号整数

userid(uniqueidentifier) --> SSIS 唯一标识符

time(7) ---> 精确的 SSIS 数据库时间

谁能告诉我我做错了什么?有没有办法解决这个错误?

提前致谢

【问题讨论】:

  • 我自己试过了,不能选择空格作为分隔符。您是否尝试过不同的分隔符,例如制表符或分号?
  • 我使用 ',' 作为分隔符 ..check this : pastie.org/3479640
  • 我从 SSIS 知道这些错误。通常它是目标列中的错误数据类型。但是我自己尝试过,我可以做我想做的事,我得到了同样的错误。有点奇怪。抱歉,目前无法为您提供帮助。
  • 您可以尝试将数据提取到一个临时表中,其中所有列的类型均为 varchar(50),这是每个平面文件列的默认数据类型。然后您可以检查您的数据。检查是否缺少分隔符、整数列中的字符、错误映射的列等。然后,一旦确定问题,您可以修改平面文件元数据和数据流目标(返回原始表),或者您可以在控制流中添加另一个组件以插入结果(我的个人喜好)。

标签: sql-server-2008 ssis sql-import-wizard


【解决方案1】:

使用单字节无符号整数作为源数据类型以映射到 tinyint 目标。 tinyint 使用 1 个字节的存储空间,其值范围为 0 到 255,因此它是无符号的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-16
    • 1970-01-01
    • 2023-01-14
    • 2022-01-04
    • 2017-09-21
    • 2017-05-04
    • 2022-06-22
    相关资源
    最近更新 更多