Successful Implementations of NAnt bcp (SQL Server) Task?

569 views Asked by At

I am looking for either a NAnt Task for SQL Server bcp, or the file format for bcp native output.

I supposed I could build a NAntContrib Task for bcp but I don't have time at the moment (Do we ever?).

Has anybody strolled this path before? Advice?

Thanks - Jon

2

There are 2 answers

0
ConcernedOfTunbridgeWells On BEST ANSWER

bcp doesn't have a native file output format as such, but can produce a binary file where the fields are prefixed by a 1-4 byte header that contains the length of the field. The length of the header or the row/column delimiter formats are specified in the control file (format described here),

If using prefixed files, SQL Server bcp uses a -1 length in the header to denote nulls.

'Native' in bcp-speak refers to binary representations of the column data. This question has some discussion of these formats.

0
Mauricio Scheffer On

You could always use NAnt's <exec> task to drive bcp...