Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Field length [Table of Contents] Using format files

Utility Guide

[-] Chapter 3 Using bcp to Transfer Data to and from Adaptive Server
[-] Changing the defaults: interactive bcp
[-] Field and row terminators

Field and row terminators

You can use a terminator to mark the end of a column or row, separating one from the next. The default is no terminator.

Terminators are very useful for dealing with character data because you can choose human-readable terminators. The bcp character option, which uses tabs between each column with a newline terminator at the end of each row, is an example of using terminators that enhance the readability of a data file.

When you prepare data for use with other programs, and when you want to use bcp to prepare tabular data, supply your own terminators. The available terminators are:

Control characters (ASCII 0-25) cannot be printed.

Choosing Terminators

Choose terminators with patterns that do not appear in any of the data.

For example, using a tab terminator with a string of data that also contains a tab creates an ambiguity: which tab represents the end of the string? bcp always looks for the first possible terminator, which in this case would be incorrect, since the first tab it would encounter would be the one that is part of the data string.

Data in native format can also conflict with terminators. Given a column that contains a 4-byte integer in native format, if the values of these integers are not strictly limited, it will be impossible to choose a terminator that is guaranteed not to appear inside the data. Use bcp's native format option for data in native format.

"No terminator" is different from a "null terminator," which is an invisible, but real, character.


Field length [Table of Contents] Using format files