gpt4 book ai didi

MySQL迁移错误: Invalid timestamp literal detected

转载 作者:可可西里 更新时间:2023-11-01 07:45:13 26 4
gpt4 key购买 nike

我正在尝试将 MS SQL 2008 R2 数据库迁移到 MySQL 5.6 CE。我正在使用 MySQL WorkBench 5.2。迁移以大量错误结束。

大部分错误是:

[WRN][ copytable]: Invalid timestamp literal detected: ''.

此错误消息没有任何意义,因为许多表没有 DateTime 列。例如,它试图从该表中迁移 4 行数据:

/****** Object:  Table [dbo].[defResidentialStatus]    Script Date: 07/11/2013 14:33:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[defResidentialStatus](
[idResStatusKey] [int] IDENTITY(1,1) NOT NULL,
[desc1] [nvarchar](50) NOT NULL,
[desc2] [nvarchar](50) NOT NULL,
[active] [bit] NOT NULL,
CONSTRAINT [PK_defResidentialStatus] PRIMARY KEY CLUSTERED
(
[idResStatusKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[defResidentialStatus] ADD CONSTRAINT [DF_defResidentialStatus_active] DEFAULT ((1)) FOR [active]
GO

日志是这样的:

TestDB.defResidentialStatus:Copying 4 columns of 4 rows from table [TestDB].[dbo].[defResidentialStatus]

''

04:33 [WRN][ copytable]: Invalid timestamp literal detected: ''

04:33 [WRN][ copytable]: Invalid timestamp literal detected: ''

04:33 [WRN][ copytable]: Invalid timestamp literal detected: ''

04:33 [WRN][ copytable]: Invalid timestamp literal detected: ''

04:33 [WRN][ copytable]: Invalid timestamp literal detected: ''

<<< Repeat the same error message about 40 times, not included to save space >>>

04:34 [WRN][ copyPROGRESS:TestDB.defResidentialStatus:4:4 ............. TestDB.defResidentialStatus has FAILED (0 of 4 rows copied)

我不知道发生了什么。这是一个非常简单的表格,有 4 列和 4 行。这不是唯一返回此类错误的表,但它是最简单的表之一。

表中数据:

1   Pending     Pending     1    
2 Arrived Arrived 1
3 Cancelled Cancelled 1
4 Departed Departed 1

最佳答案

日期时间 - 在 MYSQL 中,日期时间不包含毫秒。 SQL Server 日期时间数据类型包含毫秒。错误:“检测到无效的时间戳文字”错误。解决方案:如果您不介意丢失毫秒数,请在 SQL Server 中将 datetime 类型转换为 smalldatetime。

下面是一些转换代码:

SELECT CONVERT(smalldatetime,<columnName>);

转换后,导入它应该没有任何问题。

关于MySQL迁移错误: Invalid timestamp literal detected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17601066/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com