2013-07-11 51 views
4

我正在嘗試將MS SQL 2008 R2數據庫遷移到MySQL 5.6 CE。我正在使用MySQL WorkBench 5.2。遷移完成了大量的錯誤。MySQL遷移錯誤:檢測到無效的時間戳文字

大部分的錯誤是:

[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 
+0

這是我發現的網站可能會幫助你回答你的問題。 http://www.databasejournal.com/features/mysql/mapping-data-types-between-mysql-and-sql-server.html –

回答

0

日期時間 - 在MYSQL日期時間不包含毫秒。 SQL Server datetime數據類型包含毫秒。錯誤:「檢測到無效的時間戳文字」錯誤。解決方案:如果您不介意丟失毫秒,請將日期時間類型轉換爲SQL Server中的smalldatetime。

下面是轉換的一些代碼:

SELECT CONVERT(smalldatetime,<columnName>); 

的converison後你不應該有任何trouple其導入。