1

我正在将表的两列从一台服务器批量复制到另一台服务器。

源端的表大约有 8 列,但我只需要 2 列。

目标端的表有 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

我究竟做错了什么?

4

1 回答 1

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 是错误。

现在已经被压扁了。

于 2009-07-01T17:44:07.350 回答