打印本文 打印本文 关闭窗口 关闭窗口
usage of bcp command.(快来看)。
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4358  更新时间:2009/4/22 23:09:59  文章录入:mintao  责任编辑:mintao
s "\t" and  used for all columns except the last one), and a newline (entered  as "\n" and used for the last field in  a row). Other terminators are: "\0" (the  null terminator), "\" (backslash), and "\r" (Return).  When choosing a terminator, be sure that its pattern does not appear  in any of your character data.
For example, if you used tab terminators with a string that  contained a tab, bcp would not be able to identify  which tab represents the end of the string. bcp always  looks for the first possible terminator, so, in this example it  would find the wrong one.
When a terminator or prefix is present, it affects the length  of data transferred. If the length of an entry being copied out  to a file is less than the storage length, it is immediately followed  by the terminator or the prefix for the next field. The entry is  not padded to the full storage length (char, nchar,  and binary data is returned from Adaptive Server already padded  to the full length).
When bcp is copying in from a file, data  is transferred until either the number of bytes indicated in the "Length" prompt  has been copied or the terminator is encountered. Once the number  of bytes equal to the specified length has been transferred, the  rest of the data is flushed until the terminator is encountered.  When no terminator is used, the table storage length is strictly  observed.
稵able 4-4  and Table 4-5  show the interaction  of prefix lengths, terminators, and field length on the information  in the file. "P" indicates the prefix in the stored  table; "T" indicates the terminator; and dashes,  (--) show appended spaces. An ellipsis (...) indicates that the  pattern repeats for each field. The field length is 8 bytes for  each column; "string" represents the 6-character  field each time.
?
Table   4-4:  Adaptive Server char data
?
Table   4-5:  Other datatypes converted to char storage
稵he file storage type and length of a column do  not have to be the same as the type and length of the column in  the database table. [If the types and formats copied in  are incompatible with the structure of the database table, the copy  fails.
稦ile storage length generally indicates the maximum  amount of data that can be transferred for the column, excluding  terminators and/or prefixes.
稺hen copying data into a table, bcp observes  any defaults defined for columns and user-defined datatypes. However, bcp ignores  rules in order to load data at the fastest possible speed.
穊cp considers any data column  that can contain a null value to be variable length, so use either  a length prefix or a terminator to denote the length of each row  of data.
稤ata written to a host file in its native format  preserves all of its precision. datetime and float values  preserve all of their precision, even when they are converted to  character format. Adaptive Server stores money values  to a precision of one ten-thousandth of a monetary unit. However,  when money values are converted to character  format, their character format values are recorded only to the nearest  two places.
稡efore copying data that is in character format  from a file into a database table, check the datatype entry rules  in the Adaptive Server Reference Manual. Character data that is being  copied into the database with bcp must conform  to those rules. Note especially that dates in the undelimited format (yy)yymmdd may  result in overflow errors if the year is not specified first.
稺hen you send host data files to sites that use  terminals different from your own, inform them of the datafile_charset that  you used to create the files.


 zengcarter 回复于:2002-09-27 12:06:54 怎不弄个中文的?读起太慢了!

 月冷西湖 回复于:2002-09-27 13:15:52 很好的东西。

 2195113 回复于:2002-09-27 13:30:22 有中文的早就弄上去了。


 klutz 回复于:2002-10-22 11:17:04 用BCP可以字段级选择记录吗?

 dangsl 回复于:2002-10-23 09:12:34 在sybase网站上有PDF格式的中文文档

 pptt 回复于:2002-11-07 15:17:00 给一个下载地址啊!^_^谢谢了

 edit 回复于:2002-11-07 16:42:07 [quote][b]下面引用由[u]klutz[/u]在 [i]2002/10/22 11:17am[/i] 发表的内容:[/b]
用BCP可以字段级选择记录吗?
[/quote]

这点上就不如informix了,informix unload 命令可以写select 语句。

bcp只能整个表倒出导入,但可以用 -F -L 指定起始和结束的行数


 

上一页  [1] [2] [3] [4] [5] 

打印本文 打印本文 关闭窗口 关闭窗口