Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does VARBINARY(MAX) mean?

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?

like image 974
SPlatten Avatar asked Oct 21 '15 18:10

SPlatten


2 Answers

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

like image 116
eugenioy Avatar answered Sep 17 '22 22:09

eugenioy


In SQL Server, VARBINARY is variable length binary data, the MAX scale value means it will store up to the maximum 2^31-1 bytes.

I think the closest equivalent MariaDB data type will be LONGBLOB, which can store up to 2^32-1 bytes.

like image 30
Nathan Griffiths Avatar answered Sep 17 '22 22:09

Nathan Griffiths