I followed Microsoft's command bcp db..someTable format ...
to create a fmt file.
The table contains a varbinary(max) column.
The resultant fmt file looks like this
13.0
1
1 SQLCHAR 0 0 "\r\n" ...
When I use this fmt file to bcp "SELECT bin FROM..." queryout...
I get a corrupted PNG file.
I went back to check older fmt files, and they look like this
10.0
1
1 SQLBINARY ...
So I edited the new fmt file by changing the data type column to SQLBINARY and it works! The PNG file can now be opened.
Is this a bug with bcp 13.0? Why is the varbinary(max) column becoming SQLCHAR in the generated format file?