I'm taking jpegs and inserting them into a table as a byte array in a varbinary(MAX) data type field. However, the mdf file is growing three to four times larger in size the the total size of all of the files I'm inserting. I'm using a standard c# coding technique to take a webresponse and convert it into a memorystream:
byte[] result;
byte[] buffer = new byte[4096];
using (Stream responseStream = request.GetResponse().GetResponseStream())
{
using (MemoryStream memoryStream = new MemoryStream())
{
int count = 0;
do
{
count = responseStream.Read(buffer, 0, buffer.Length);
memoryStream.Write(buffer, 0, count);
} while (count != 0);
result = memoryStream.ToArray();
}
}
And yet somehow 512mb of jpegs ends up growing the mdf over 2gb in size. Where I do the insert into the table I am defining the length on this field as well using result.length. Auto grow is set to 5%.