Read VARBINARY(MAX) from SQL Server to C# -
i need read data row sql server 2008. type of 1 of columns varbinary(max)
. in c# want use out parameter read (and given scenario satisfies needs mostly).
but need specify parameter variable size fill c# variable. here assume 8000 enough... knows:
database.addoutparameter(command, "vbcertificate", dbtype.binary, 8000);
so questions are:
- what size of max in number sql server 2008?
- is ok use out parameter scenario?
as @marc_s said, want add something.
there 2 data types
binary [ ( n ) ]
fixed-length binary data length of n bytes, n value 1 through 8,000. storage size n bytes.
varbinary [ ( n | max) ]
variable-length binary data. n can value 1 through 8,000. max indicates maximum storage size 2^31-1 (equals int.maxvalue i.e. 2,147,483,647) bytes. storage size actual length of data entered + 2 bytes. data entered can 0 bytes in length.
if specifying max concern should varbinary instead of binary
database.addoutparameter(command, "vbcertificate", dbtype.binary, 8000);
database.addoutparameter(command, "vbcertificate", sqldbtype.varbinary, int.maxvalue);
Comments
Post a Comment