November 14, 2007 at 9:20 am
I am using sql server 2005 with asp.net. I am storing images in a varbinary(max) field. I would like to find out the amount of bytes stored in the field. For example, if I put a 30kb file in the field, is there a function in sql server 2005 to tell me that the field has 30kb of data?
Thanks,
Ron
November 14, 2007 at 10:19 am
damn that is interesting...my first instinct was that the len() function would work on a varchar(max), but it just returns 8000 if it is too big: I'll look some more.....
create table tmp(val varchar(max))
insert into tmp(val)
select replicate('12345',32767) UNION
select replicate('xrtg',41527)
select len(val) from tmp --select datalength(val) from tmp --same behavior
results:
8000
8000
Lowell
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply