我正在尝试使用 AWS Database Migration Service (DMS) 从 S3 填充 SQL Server 2014 表。我有以下 S3 架构:
{
"TableCount": "1",
"Tables": [
{
"TableName": "employee",
"TablePath": "public/employee/",
"TableOwner": "",
"TableColumns": [
{
"ColumnName": "Id",
"ColumnType": "INT8",
"ColumnNullable": "false",
"ColumnIsPk": "true"
},
{
"ColumnName": "HireDate",
"ColumnType": "TIMESTAMP"
},
{
"ColumnName": "Name",
"ColumnType": "STRING",
"ColumnLength": "20"
}
],
"TableColumnsTotal": "3"
}
]
}
当我运行迁移任务时,我收到以下溢出错误,因为 SQL Server 不允许将2018-04-11 08:02:16.788027
S3 中的值插入到 SQL ServerDATETIME
列中。
我的问题是,有没有一种方法可以告诉 AWS DMS在 SQL Server 中将TIMESTAMP
S3 数据创建为DATETIME2
列?注意:每次迁移运行时,都会删除并重新创建表。我可以通过使用 HireDate as 在 SQL-Server 中手动创建表来解决此问题DATETIME2
,然后将 DMS 迁移“目标表准备模式”设置为TRUNCATE
而不是删除/创建,但这对于我当前的解决方案来说并不理想。
[TARGET_LOAD ]E: Failed to execute statement: 'INSERT INTO [public].[employee]([Id],[HireDate],[Name]) values (?,?,?)' [1022502] (ar_odbc_stmt.c:2456)
[TARGET_LOAD ]E: RetCode: SQL_ERROR SqlState: 22008 NativeError: 0 Message: [Microsoft][ODBC Driver 13 for SQL Server]Datetime field overflow. Fractional second precision exceeds the scale specified in the parameter binding. Line: 1 Column: 4 [1022502] (ar_odbc_stmt.c:2462)
[TARGET_LOAD ]E: Invalid input for column 'HireDate' of table 'public'.'employee' in line number 1.(sqlserver_endpoint_imp.c:2357)