|
Posted by Erland Sommarskog on 09/21/05 00:40
Patrik (patrik.maheux@umontreal.ca) writes:
> Is there any way of including headers when we export a table using bcp
> ? Can't find the argument in bcp utility books online ?
BCP does not unfortunately not support headers very well. If they can
be molded into the format of the rest of the file, you can sneak by.
Here are some examples:
value1,value2,value3
12,23,234
This is easy, use the -F option to start on row 2. Here is a tricker one:
value1,value2,value3
"text",12,"more test"
For this format you need a format file anyway for the data. This format
file will specify that each record begins with an empty column with " as
terminator. The result is that the header slips into that empty column
for the first row. You should not use -F.
Here is a dead end:
value1,value2,value3
12,"my text",12
I can't find a way to bulk-load this file, because the header does not
match the format of the data rows, and you can hide it an empty column.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Navigation:
[Reply to this message]
|