You can use an optional terminator to mark the end of a column, separating one column from the next. The default is no terminator. To accept the default, press ENTER when prompted.
When you are preparing data for use with other programs and when you want to use bcp to prepare tabular data, you will usually want to supply your own terminators. The following terminators can be used:
Terminator | Indicated by |
---|---|
Tabs | \t |
New lines | \n |
Carriage returns | \r |
Backslash | \\ |
Null terminators (no visible terminator) | \0 |
Any printable character | (*, A, t, l, and so on) |
Strings of up to 10 printable characters, including some or all of the terminators listed previously (**\t**, end, !!!!!!!!!!, \t--\n, and so on; control characters are not printable) |
The /t and /r options let you change the default terminators. When you use these options, the default that is listed in the prompt changes to the value you specify on the command line. The following example changes the default field terminator to the tab character (\t) and the default row terminator to the newline character (\n):
bcp pubs..publishers out publ_out /t \t /r \n /Sservername /Usa /Ppassword
Important Terminators must be chosen to ensure that their pattern does not appear in any of the data. For example, using tab terminators with a string that contains a tab results in an ambiguity: which tab represents the end of the string? The bcp utility always looks for the first possible terminator, which in this case would be incorrect.
Native format data can also conflict with terminators. Given a column that contains a 4-byte integer in native (non-ASCII) format, if the values of these integers are not strictly limited, it is impossible to choose a terminator that is guaranteed not to appear inside the data.
Any data column that can contain null values is considered variable length for bcp purposes. Therefore, a length prefix or terminator should be used to specify the length of each row's data.
Note The no terminator value is different from the null terminator value. The no terminator value puts no terminator after the column. The null terminator value puts a null character after the column. A null character is an invisible but real character.