Monday, March 19, 2012

How to get size of an image data type field stored in my SQL Server Database

Hi,
I have a problem and don't know how to solve it.
I am storing files (jpg, etc) in a table as binaries (image data type)
and would like to be able to show progress bar when I am loading it
from database.
But to do that, I need somehow to get the size of that file that is
stored in database (as image data type). Unfortunatelly my table does
not have a 'file_size' column from where I could get the size of image
and I am not in position to change that.
So far I am reading or writing to databasse successfully using
FileStream or BinaryREader/Writer (in VB.NET), so that is not the
problem.
Does anybody know how can I get the size of an file stored in
database?
Any help will be greatelly appreciatedTry the following function
select datalength(imagecolumn) from table where x=y
"Dino Buljubasic" <dino@.noplacelikehome.com> wrote in message
news:j74v21t1saqrl2b25cr16dnc93mo00emv3@.
4ax.com...
> Hi,
> I have a problem and don't know how to solve it.
> I am storing files (jpg, etc) in a table as binaries (image data type)
> and would like to be able to show progress bar when I am loading it
> from database.
> But to do that, I need somehow to get the size of that file that is
> stored in database (as image data type). Unfortunatelly my table does
> not have a 'file_size' column from where I could get the size of image
> and I am not in position to change that.
> So far I am reading or writing to databasse successfully using
> FileStream or BinaryREader/Writer (in VB.NET), so that is not the
> problem.
> Does anybody know how can I get the size of an file stored in
> database?
> Any help will be greatelly appreciated
>

No comments:

Post a Comment