Format Files

By using a format file, you can customize the data file created by bcp or specify complex field layouts for data loads. There are two ways to create a format file: by using interactive bcp and by using the format switch.

Customizing a Format File by Using Interactive bcp

If you do not specify one of the –n, –c, or –w data type format switches, bcp (in or out) prompts you for the following information for each column in the data set:

File storage type

Prefix length

Field length

Field terminator

bcp offers a default for each of these prompts that you can either accept or reject. If you accept all the defaults, you wind up with the same format file you would have by specifying the native format (with the –n switch). The prompts ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.