Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Check length of data in IMAGE field

Author  Topic 

rwolfcastle
Starting Member

8 Posts

Posted - 2004-12-15 : 02:55:39
Is there a way to return the length of data stored in an image field? I thought that, perhaps, DATALENGTH might do it but it doesn't let me. I've tried searching Google to death but keep getting rubbish. Maybe I'm asking something that's impossible (a habit I seem to be forming, alas :-)

I am successfully uploading data from an ASP page using the ADODB.Stream object and using the .Size property to send the content-length, but I was hoping to check the length of the data in the database to confirm that the data has been saved (and, therefore, where to look next to debug my problem if the data did get saved).

Thanks.

My eyes... the goggles do nothing!

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-12-15 : 08:12:21
What do you mean "it doesn't let me"? That's the only function that would return the length of the data in an image column. The only reason I can think of that wouldn't work is if the image column had gotten corrupted.

And I hate to sound like a broken record, but I'll bet if you stored this as files you wouldn't have these problems (might have rafts of DIFFERENT ones, but at least not these)
Go to Top of Page

TimS
Posting Yak Master

198 Posts

Posted - 2004-12-15 : 13:25:36
Simple Question how large/many or total size of images do you think is too much for SQL Server to handle.
I store my application paradox forms in a table with an integer primary key and a blob.
I use DB-Library via Paradox 9 to upload the Blobs and a in-house DLL to download via the Borland BDE ( DB-Library ); BLOBs in this case means image datatype.

On production the following exists; what do you think about it?
342 BLOBS
avg size 61,756 bytes
max size 1,888,224 bytes
total 21,120,770 bytes

select DATALENGTH(blob_data) from pdx_file_data_storage

NOTE: In dealing with BLOBS somewhere I had to make the first column a primary key for operation to work; this most likely is a BDE/Paradox only requirement. I did this design choice in 99 so the reason is very cloudy and under sql 7.0.

Tim S
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-15 : 13:47:52
Well the amount and size of data you have is fairly trivial.
Shouldn't cause sql server a problem.

Whether or not it is a good idea is another question.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

rwolfcastle
Starting Member

8 Posts

Posted - 2004-12-15 : 17:52:28
Hmm, after trying it just now, it works. I've gone and made a fool and a liar out of myself. This is what I typed in (which I'm sure I did yesterday) and it worked OK (revealing a few zeros, but that's my problem somewhere else, evidently)

SELECT DATALENGTH(FileBlob) AS FileSize FROM DocumentBlob

My eyes... the goggles do nothing!
Go to Top of Page
   

- Advertisement -