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.
Asked
Active
Viewed 8,234 times
1

JAX
- 1,540
- 3
- 15
- 32
-
Which version of MySQL are you using? – David Faber Nov 09 '14 at 00:31
-
Possible duplicate: http://stackoverflow.com/questions/13506832/what-is-the-mysql-varchar-max-size – Sam Nov 09 '14 at 00:51
-
@Sam: I'm not looking for NUMERICAL value of the max length, so this is not the duplicate of that post, I'm looking for a built in function like MAX to automatically determine that – JAX Nov 09 '14 at 01:02
2 Answers
3
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.

sbrbot
- 6,169
- 6
- 43
- 74
-
I'm not interested in knowing the numerical value of max lengths, I wanna know if there's any built in function like SQL Server's MAX that can automatically define that. – JAX Nov 09 '14 at 01:07
-
No in MySQL there's no such a const MAX which defines the maximum column length. – sbrbot Nov 09 '14 at 17:37
2
The equivalent to varbinary(max)
would LONGBLOB
in MySQL: