Respond to bcp Prompts

Unless you supplied bcp with the -P parameter, it prompts you for your password when you copy data in or out using the -n (native format) or -c (character format) parameters. If you do not supply either the -n, -c or -f formatfile parameter, bcp prompts you for information for each field in the table or view.

Each prompt displays a default value, in brackets, which you can accept by pressing Return. The prompts include:

The row terminator is the field terminator of the last field in the table, view, or file.

The bracketed defaults represent reasonable values for the datatypes of the field in question. For the most efficient use of space when copying out to a file:

Table 2-2 shows the bcp prompts, defaults, and the possible alternate user responses:

Table 2-2: Defaults and user responses for bcp prompts

Prompt

Default provided

Possible user response

File Storage Type

Use database storage type for most fields except:

  • char for varchar

  • binary for varbinary

char to create or read a human-readable file; any Adaptive Server datatype where implicit conversion is supported.

Prefix Length

  • 0 for fields defined with char datatype (not storage type) and all fixed-length datatypes

  • 1 for most other datatypes

  • 2 for binary and varbinary saved as char

  • 4 for text and image

0 if no prefix is desired; otherwise, defaults are recommended.

Storage Length

  • For char and varchar, use defined length.

  • For binary and varbinary saved as char, use double the defined length.

  • For all other datatypes, use maximum length needed to avoid truncation or data overflow.

Default values, or greater, are recommended.

Field or Row Terminator

None

Up to 30 characters, or one of the following:

  • \t – tab

  • \n – newline

  • \r – carriage return

  • \0 – null terminator

  • \ – backslash