1

I have to insert a byte array into a VARBINARY(max) in SQLServer2008 trough a stored procedure and when one of my byte array element is equal to 0x00 my byte array is split.

I use an SQLBindParameter to insert my data in the DB, and it work normally when I haven't any 0x00 value in my array.

chrisaycock
  • 36,470
  • 14
  • 88
  • 125
Weqk
  • 21
  • 1
  • 4
  • 1
    Would you happen to be using a `std::string` to store binary data ? And remember to always show some code ! – Nbr44 Apr 12 '13 at 14:24
  • Nop i have to use a regular byte array `byte var[]` and it's probably not a code problem. But that my bind : `SQLBindParameter(m_hSQLStmt,4,SQL_PARAM_INPUT,SQL_C_BINARY,SQL_LONGVARBINARY,iSizeOfData*sizeof(baData),NULL,baData,NULL,NULL);` – Weqk Apr 12 '13 at 14:28
  • Could the byte array perchance be treated as a `char[]` or `char*` at some point? – Daniel Fischer Apr 12 '13 at 14:31
  • Yep in the bind `baData` is a byte * which designe my array – Weqk Apr 12 '13 at 14:33

1 Answers1

0

I can also change my insertion method, so if somebody already done something to put a binary stream (byte[]) in an varbinary in sql server it will probably really help me.

Weqk
  • 21
  • 1
  • 4