BCP output to byte array into table?

Hi all.
Situation:

Have old MS DOS batch files (yup).
They do some funky stuff and one of them is to do BCP to a file.
I am trying to get rid of the "write to file" portion for a number of reasons and instead, as a stepping stone in aid of another process, get the data BCP see's and put it into a byte[] array (varbinary) and place that into a SQL Table.

  • how do you do that using BCP?
  • I would hope that if I extract the byte[] data back into a file that it will be in the correct format and nothing gets altered.

bcp can't avoid writing to a file. However, the BulkCopy class might do what you're asking:

For use in a batch file/CLI environment you'll have to compile it to an EXE utility.

Thanks! yeah I was wanting to avoid that but does look like I have to go to .NET code to do what I want... sigh