2009-07-01 50 views
1

我正在運行一個表的兩列從一臺服務器到另一臺的大容量副本。BCP實用程序損壞數據

在源極側上的表具有約8列,但我只需要2.

在目的地側表有兩列(即我需要兩個,兩者都是int型)

兩個數據庫是SQL Server 2005的

這裏是我的兩個BCP命令:

c:\> bcp "select c1, c2 from srcTable" queryout tableData.bcp -N -T -S srcServer 
c:\> bcp destTable in tableData.bcp -N -T -S destServer 

爲什麼這個腐敗的目標表中的數據?我應該是越來越好,順序整數,而不是我得到這個:

c1   c2 
586332  83014148 
123128736 -105042384 
-561616278 -309997736 

我做錯了什麼?

回答

1

明白了。

列定義必須完全匹配 - 包括它是NULL還是NOT NULL。

來源有:

srcTable (
c1 int not null (PK) 
c2 int null 
c3 datetime not null 
c4 datetime null 
... 
) 

目標表有:

destTable (
c1 int not null (PK) 
c2 int not null 
) 

上destTable.c2的NOT NULL是錯誤。

現在已被壓扁。