使用SQL Server导出向导时无效的日期格式

时间:2016-10-19 04:52:09

标签: sql-server datetime sql-server-2012 export invalid-argument


我正在尝试将数据从一个SQL Server导出到另一个SQL Server。我有大约12个表,其中11个成功导出但是在一个表中有问题,它有2列var result = ""; result += "["; for(i=0;i<=10;i++) { result += "{ 'key': 'keyvalue" + i + "', 'values': ["; for(j=0;j<=10;j++) { result += "{ 'key': 'subkeyvalue"+j+"', 'value':"+j+"}, "; } result += "]}, "; } result += "]"; console.log(result); console.log(JSON.stringify(result)); console.log(JSON.parse(result));而导出我得到这个例外:

DateTime

它成功复制了大约4025行,我有大约21794行,所以有点难以手动查看每一行,所以我试着运行

- Copying to [dbo].[ClaimDetails] (Error)
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80004005  Description: "Invalid date format".
(SQL Server Import and Export Wizard)

Error 0xc020901c: Data Flow Task 1: There was an error with Destination -     ClaimDetails.Inputs[Destination Input].Columns[Entrydate] on Destination -   ClaimDetails.Inputs[Destination Input]. The column status returned was:   "Conversion failed because the data value overflowed the specified type.".
(SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task 1: SSIS Error Code   DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "Destination -  ClaimDetails.Inputs[Destination Input]" failed because error code 0xC020907A  occurred, and the error row disposition on "Destination -  ClaimDetails.Inputs[Destination Input]" 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 "Destination -  ClaimDetails" (124) failed with error code 0xC0209029 while processing input  "Destination Input" (137). 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 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data  Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.   The PrimeOutput method on Source - ClaimDetails 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.
 (SQL Server Import and Export Wizard)

在两个字段上但没有显示任何行,所以请让我知道我能做什么。

日期字段格式如下所示 Date fields format look like this

由于

2 个答案:

答案 0 :(得分:0)

您应该先设置dateformat。查看您的记录,应该是 ymd

    SET DATEFORMAT ymd;

SELECT *
FROM ClaimDetails
WHERE ISDATE(ActualDate) = 0

答案 1 :(得分:0)

按日期字段对表进行排序(从最旧到最新)。如果存在Null值,则滚动到包含数据的第一条记录。现在,请确保该年份是正确的年份。

相关问题