Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a big technical difference between VARBINARY(MAX) and IMAGE data types?

I was reading on internet these statements about SQL Server data types:

  1. VARBINARY(MAX) - Binary strings with a variable length can store up to 2^31-1 bytes.

  2. IMAGE - Binary strings with a variable length up to 2^31-1 (2,147,483,647) bytes.

Is there a really big technical difference between VARBINARY(MAX) and IMAGE data types?

If there is a difference: do we have to customize how ADO.NET inserts and updates image data field in SQL Server?

like image 585
Junior Mayhé Avatar asked Nov 06 '10 13:11

Junior Mayhé


People also ask

What is the difference between varbinary and image?

VARBINARY(MAX) - Binary strings with a variable length can store up to 2^31-1 bytes. IMAGE - Binary strings with a variable length up to 2^31-1 (2,147,483,647) bytes.

When would you use varbinary data type?

The VARBINARY data type holds variable-length binary data. Use this type when the data is expected to vary in size. The maximum size for VARBINARY is 8,000 bytes.

What is the difference between varbinary and binary?

binary [ ( n ) ] Fixed-length binary data with a length of n bytes, where n is a value from 1 through 8,000. The storage size is n bytes. varbinary [ ( n | max) ] Variable-length binary data. n can be a value from 1 through 8,000.

What is the data type for image?

An image is a composite data type. An image file is typically a binary format file.


1 Answers

They store the same data: this is as far as it goes.

"image" is deprecated and has a limited set of features and operations that work with it. varbinary(max) can be operated on like shorter varbinary (ditto for text and varchar(max)).

Do not use image for any new project: just search here for the issues folk have with image and text datatypes because of the limited functionality.

Examples from SO: One, Two

like image 119
gbn Avatar answered Sep 22 '22 08:09

gbn