IMAGE and other deprecated binary types
Two engines shipped binary types they later regretted. SQL Server's IMAGE and Oracle's LONG RAW still work, still appear in old schemas, and both block features you probably want.
- Family
- Binary & blobs
- Missing in
- None of the five
- Gotchas
- 4 listed
Engine by engine
IMAGE (SQL Server, 2 GB) and LONG RAW (Oracle, 2 GB) are deprecated legacy blob types with real restrictions; the migration targets are VARBINARY(MAX) and BLOB.
| Moteur | Type | Stockage | Notes |
|---|---|---|---|
| SQL Server |
IMAGE
|
up to 2 GB | Deprecated since 2005; the replacement is VARBINARY(MAX). IMAGE cannot be compared, sorted, grouped or used as a local variable. |
| PostgreSQL |
BYTEA
|
up to 1 GB | No deprecated type to retire; BYTEA has always been the answer for binary data. |
| MySQL |
LONGBLOB
|
up to 4 GB | No deprecated image type; LONGBLOB is the storage equivalent for legacy IMAGE columns. |
| SQLite |
BLOB
|
up to 1 billion bytes | One BLOB type from the start; nothing to migrate. |
| Oracle |
LONG RAW
|
up to 2 GB | Deprecated: one LONG or LONG RAW column per table, no SQL functions on it, and no CREATE TABLE AS SELECT. Migrate to BLOB. |
Gotchas
Where the engines disagree. These tend to surface as bugs during a migration or a port.
- SQL Server's IMAGE fails in = comparisons, ORDER BY, GROUP BY and DISTINCT, cannot be a local variable, and needs READTEXT/WRITETEXT/UPDATETEXT for partial access. It has been deprecated since 2005.
- Oracle LONG RAW allows only one per table, cannot be used in expressions or most functions, and the migration to BLOB is not a plain CAST - it needs ALTER TABLE MODIFY or a copy through a LOB operation.
- The deprecated trio TEXT, NTEXT and IMAGE often appear together in old SQL Server schemas; all three migrate to VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) respectively.
- ALTER TABLE t ALTER COLUMN c VARBINARY(MAX) converts in place, but old client code that calls READTEXT or WRITETEXT on the column breaks, so search the codebase before migrating.
Common questions
What replaces IMAGE in SQL Server?
VARBINARY(MAX). It stores the same data, supports all functions and modern drivers, moves large values off-row automatically, and has no deprecated behavior.
How do I migrate Oracle LONG RAW to BLOB?
Not with a plain CAST. Use ALTER TABLE ... MODIFY (col BLOB) or copy the data through TO_LOB in an INSERT ... SELECT, then drop the old column.
Can I still create IMAGE columns?
In SQL Server yes, and tools still accept them, but new code should not: they are deprecated, restricted, and the eventual removal will break them.
Related on SQLly
Map a type to the other four engines
The free type converter maps a type from one engine to its closest equivalent in the others and says where storage, precision or behaviour differ. The desktop app does the same mapping while you edit.