What does VARBINARY(MAX) mean?

SPlatten picture SPlatten · Oct 21, 2015 · Viewed 19.2k times · Source

I'm trying to port a MSSQL database over to MariaDB and I've encountered a table creation using varbinary(max):

    `definition` VARBINARY(max) NULL DEFAULT NULL

What would this actually do and is there an equivalent type definition in MariaDB that I could use?

Answer

eugenioy picture eugenioy · Oct 21, 2015

As others have stated in the comments, VARBINARY(max) in MSSQL refers to:

Variable-length binary data.

max indicates that the maximum storage size is 2^31-1 bytes.

From what I found in MariaDB's documentation, the only way of getting a similar storage size in MariaDB is to use the LONGBLOB data type:

LONGBLOB

A BLOB column with a maximum length of 4,294,967,295 bytes or 4GB (2^32 - 1).

Useful links:

https://msdn.microsoft.com/en-us//library/ms188362.aspx

http://www.techonthenet.com/mariadb/datatypes.php