```html SQL Server IMAGE Data Type - MSDN Documentation

MSDN Documentation

IMAGE Data Type

Note: The IMAGE data type is deprecated. Microsoft recommends using VARBINARY(MAX) for new development.

Synopsis

The IMAGE data type stores variable-length binary data up to 2,147,483,647 bytes (2 GB). It is often used to store pictures, graphics, or other large binary objects.

Syntax

column_name IMAGE [NULL | NOT NULL]

Example Usage

-- Create a table with an IMAGE column
CREATE TABLE dbo.ProductImages
(
    ProductID INT PRIMARY KEY,
    ImageData IMAGE NULL
);
GO

-- Insert an image from a file
INSERT INTO dbo.ProductImages (ProductID, ImageData)
SELECT 101, BulkColumn FROM OPENROWSET(BULK N'C:\Images\example.jpg', SINGLE_BLOB) AS img;
GO

-- Retrieve the image
SELECT ProductID, ImageData
FROM dbo.ProductImages
WHERE ProductID = 101;
GO

Properties

PropertyValue
Maximum Length2,147,483,647 bytes (2 GB)
StorageOut-of-row storage if > 8 KB
Supported inSQL Server 2000 – 2019 (deprecated in 2008 onward)
Preferred ReplacementVARBINARY(MAX)

Related Topics

Version History

SQL Server VersionStatus
SQL Server 2000Supported
SQL Server 2005Supported (Deprecated)
SQL Server 2008Deprecated
SQL Server 2012+Supported for backward compatibility only
```