I was able to run the bcp from command line for remote server:
bcp "select Data from [Test_Db21].[Test_Db21].[attachments_blob] where attachments_dbid=33556500" queryout c:\blob\outofsql.png -T -L 1 -S " stats005.xzp.com" -f c:/blob/bcp.fmt
The same command from within T-sql failed:
SET @cmd = 'bcp "select Data from [Test_Db21].[Test_Db21].[attachments_blob] where attachments_dbid=33556500" queryout c:\blob\outofsql.png -T -L 1 -S " stats005.xzp.com" -f c:/blob/bcp.fmt'
EXEC @result = xp_cmdshell @cmd
SELECT @result
SQLState = 28000, NativeError = 18456
Error = [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'USC\MYPC$'.
Thank you in advance