VarBinary vs Image SQL Server Data Type to Store Binary Data?

Viewed 129758

I need to store binary files to the SQL Server Database. Which is the better Data Type out of Varbinary and Image?

4 Answers

Since image is deprecated, you should use varbinary.

per Microsoft (thanks for the link @Christopher)

ntext , text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use nvarchar(max), varchar(max), and varbinary(max) instead.

Fixed and variable-length data types for storing large non-Unicode and Unicode character and binary data. Unicode data uses the UNICODE UCS-2 character set.

varbinary(max) is the way to go (introduced in SQL Server 2005)

There is also the rather spiffy FileStream, introduced in SQL Server 2008.

Related