Monday, April 21, 2008

T-SQL datalength (image size or length)

Sometimes you have to insert into a database some binary information(like images). The MS SQL data type for this kind of data is image. Very often you want to know the exact size or length of the data you have in that comlumn.

The SQL function that returns the "number of bytes used to represent any expression" is DATALENGTH ( expression ) .

As an example:
FROM MyImagesTable

No comments: