利用bcp导入表数据中有image列问题

今天遇到个麻烦事,就是利用bcp导数据,以前导的都成功,可是今天导出的就出问题了,因为它的列中有image类型的列.
问题一:开始导出的时候报错,说client/server字符集不一致
解决办法:在使用bcp的主机的sybase安装目录下找到locales.dat文件,将上面的iso_1(client)修改为eucgb(server)即可。至于server字符集是什么,可以通过报错信息看出来.
导出数据:C:\sybase\OCS-12_5\bin>bcp ttms_test.dbo.TBL_TTMS_REPORT_TEMPLATE out D:\TBL_TTMS_REPORT_TEMPLATE -Usa -P -S ttms -t -c
导出数据成功.

问题二:导入数据失败
我用的是C:\sybase\OCS-12_5\bin>bcp ttms_upload.dbo.TBL_TTMS_REPORT_TEMPLATE in D:\TBL_TTMS_REPORT_TEMPLATE -Usa -P -S ttms -t -c
解决办法:
C:\sybase\OCS-12_5\bin>bcp ttms_upload.dbo.TBL_TTMS_REPORT_TEMPLATE in D:\TBL_TT
MS_REPORT_TEMPLATE -Usa -P -S ttms

Enter the file storage type of field ID [numeric]:
Enter prefix-length of field ID [1]:
Enter field terminator [none]:
Enter precision of field ID [19]:
Enter scale of field ID [0]:

Enter the file storage type of field FILE_NAME [char]:
Enter prefix-length of field FILE_NAME [0]:
Enter length of field FILE_NAME [100]:
Enter field terminator [none]:

Enter the file storage type of field DISPLAY_NAME [char]:
Enter prefix-length of field DISPLAY_NAME [0]:
Enter length of field DISPLAY_NAME [100]:
Enter field terminator [none]:

Enter the file storage type of field REALFILE [image]:
Enter prefix-length of field REALFILE [4]:
Enter field terminator [none]:

Do you want to save this format information in a file? [Y/n]

Host filename [bcp.fmt]:

Starting copy...

6 rows copied.
Clock Time (ms.): total = 78  Avg = 13 (76.92 rows per sec.)

C:\sybase\OCS-12_5\bin>

见解:开始不明白为什么导不进去,就是老抱错,说语法错误.我去掉-t -c,然后不停按回车,居然导入成功了.后来想想看过的bcp详细介绍,-c是导入char形式的,别的字段都识别,而image字段不识别,你把它导出char行,把char导成image不行,所以它老说语法错误.去掉-t -c后,他会询问你每个字段的类型,还有长度,所以才出现上面的我不挺按回车会成功.不管怎样,导入成功了.元旦快乐!

转载于:https://www.cnblogs.com/zyl-8183/archive/2006/12/31/609117.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值