简体   繁体   中英

Equivalent of SQL Server's `MAX` in MySQL

When defining a column in SQL Server we can do [Photo] VARBINARY(MAX) , this automatically sets the length of the field to the maximum. In MySQL I've tried to do the same but it seems that that this should be done in another way. So, I've been looking for the equivalent of this in MySQL. I've tried googling by I keep coming up with the results defining the max in numeric value like 65535. Tried that, but the MySQL says it is too large for the field.

No in MySQL there's no such a const MAX which defines the maximum column length. Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size (65,535 bytes, which is shared among all columns) and the character set used.

The equivalent to varbinary(max) would LONGBLOB in MySQL:

http://dev.mysql.com/doc/refman/5.5/en/blob.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM