简体   繁体   English

将Excel数据导入SQL Server并转换为DateTime

[英]Importing Excel data into SQL Server and converting to DateTime

guys, 伙计们,

I've got some datetime data in an Excel file, formatted appropriately for SQL Server datetime conversion (yyyy-mm-dd hh:mm:ss:000). 我在Excel文件中有一些日期时间数据,其格式经过适当格式化以适合SQL Server日期时间转换(yyyy-mm-dd hh:mm:ss:000)。 Unfortunately, when I try to import the data into an SQL field of type DateTime, I get these error messages: 不幸的是,当我尝试将数据导入到DateTime类型的SQL字段中时,出现以下错误消息:

Error 0xc02020c5: Data Flow Task 1: Data conversion failed while converting column "Datetime" (27) to column "Datetime" (60).  The conversion returned status value 2 and status text "The value could not be converted because of a potential loss of data."

Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Data Conversion 0 - 0.Outputs[Data Conversion Output].Columns[Datetime]" failed because error code 0xC020907F occurred, and the error row disposition on "Data Conversion 0 - 0.Outputs[Data Conversion Output].Columns[Datetime]" 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.

Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED.  The ProcessInput method on component "Data Conversion 0 - 0" (52) failed with error code 0xC0209029 while processing input "Data Conversion Input" (53). 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.

Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on Source - Sheet2$ returned error code 0xC02020C4.  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.

Any idea on what I'm doing wrong? 关于我在做什么错的任何想法吗? I specifically have to import from Excel and not from CSV because there is Hebrew text in the source file which SQL Server refuses to recognize with any of the encodings available in CSV import. 我特别必须从Excel而不是从CSV导入,因为源文件中有希伯来语文本,SQL Server拒绝使用CSV导入中可用的任何编码来识别。

` `

最终有效的方法是完全删除毫秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM