- 论坛徽章:
- 0
|
本帖最后由 jun286142911 于 2012-12-25 17:00 编辑
各位大虾门,求助。。
问题如下:公司要求把数据库A的表中数据都导出来,然后把它导入到数据库B中去。。
我用bcp ter..t_net out /home/sybase/111/t_ne -U sa -P 123456 -c -Jcp936 可以把数据导出来,但是导进去的时候用bcp ter..t_net in /home/sybase/111/t_ne -U sa -P 123456 -c -Jcp936 -E 出现如下的错误:Server Message: ITAS - Msg 7756, Level 16, State 1:
Cannot use 'SET IDENTITY_INSERT' for table 'ter..t_ne' because the table does not have the identity property.
CTLIB Message: - L1/O1/S1/N183/1/0:
ct_options(): user api layer: external error: An error was returned from the server while setting the options, check the server message for details.
Setting connection options failed.
如果去掉-E 就会出现如下错误:
Starting copy...
Server Message: ITAS - Msg 2601, Level 14, State 1:
Attempt to insert duplicate key row in object 't_net' with unique index 't_manager_5760020521'
bcp copy in failed
求教求教~! 希望给力回复啊!!!!
[该问题已经解决了,呵呵] bcp ter..t_net out /home/sybase/111/t_ne -U sa -P 123456 -c -Jcp936 这个是用在没有自增字段的时候,在导入前,应该用先将t_ne表中数据清空 即执行 isql -U sa -P 123456
1>delete from t_ne
2>go
3>quit
然后再运行bcp ter..t_net out /home/sybase/111/t_ne -U sa -P 123456 -c -Jcp936 ,当碰到有自增字段为identity时,就要执行bcp ter..t_net out /home/sybase/111/t_ne -U sa -P 123456 -c -Jcp936 -E
|
|