我运行一个表中的两列的从一个服务器批量复制到另一个。

在源侧的表具有约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

我在做什么错了?

有帮助吗?

解决方案

得到它。

列定义必须完全匹配。 - 的包括是否是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是错误。

它的被现在压扁。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top