如何解决CSV文件导入中的字符串[DT_STR]错误

eivgtgni  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(119)

我导出了一个表,也从CSV文件中的数据库。然后我打算导入到MSSQL Server使用SSMS 18。
我在MSSQL Server中创建了表,保留了相同的数据类型,如下所示:

CREATE TABLE [dbo].[employee_account](
    [UserID] [int] NOT NULL,
    [debit_acct_no] [varchar](20) NOT NULL,
    [active] [bit] NOT NULL,
    [create_dt] [datetime] NULL,
    [created_by] [varchar](45) NULL,
    [Limit] [numeric](26, 6) NOT NULL,
    [allow_od] [char](1) NOT NULL,
    [allow_bal_enq] [char](1) NULL,
    [scheme_type] [varchar](20) NULL
) ON [PRIMARY]
GO

字符串
然后我遵循这一步:
右键单击DB ->单击任务->导入数据->下一步->选择平面文件作为数据源->等等。
它在非字符串(Varchar,char)的列上标记,并且从CSV文件导入失败。
x1c 0d1x的数据
示例数据:

UserID,debit_acct_no,active,create_dt,created_by,Limit,allow_od,allow_bal_enq,scheme_type
1,9876765432,1,20/03/2017 7:55:47.396,HAMIT LAMIL,13388.330000,N,,
1,2345654362,1,20/03/2017 7:56:01.120,HAMIT LAMIL,17715.330000,N,,
1,8797654324,1,20/03/2017 7:56:04.663,HAMIT LAMIL,88185.880000,N,,


我不想把所有其他列都转换为varchar。
即使我取消了隐蔽,问题仍然存在。
最后,我这样做了,但是create_dt的问题没有解决。



当我完成这个过程时,我得到了这个错误:

Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "create_dt" (22) to column "create_dt" (88).  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[create_dt]" failed because error code 0xC020907F occurred, and the error row disposition on "Data Conversion 0 - 0.Outputs[Data Conversion Output].Columns[create_dt]" 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" (72) failed with error code 0xC0209029 while processing input "Data Conversion Input" (73). 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)
 
Error 0xc0209017: Data Flow Task 1: Setting the end of rowset for the buffer failed with error code 0xC0047020.
 (SQL Server Import and Export Wizard)


我该如何解决这个问题并解决这个问题?

whlutmcx

whlutmcx1#

source typpe:选择Unicode字符串[DT_WSTR]

相关问题