Search code examples
sql-serverencodingbcp

How does BCP queryout encode varbinary(max) and can I change the encoding?


I have a legacy system that has byte arrays of images(jpg) stored in the database in varbinary(max) columns. What is the default encoding being used by sql bcp to create the string that it writes to the flat file? Also, can I change the encoding?


Solution

  • When you output using bcp the default format is native or you can force that with the -n (-N will also work since it stores noncharacter data as native).

    Kalman Toth's website has an example http://www.sqlusa.com/bestpractices/imageimportexport/