Column table String type max length
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 03:36 AM
Hi all,
I have a question about the max length of column of type string.
I created a new column and set the max length to 5000 but once I go to the form I can paste a string of 20000 character in the field. I save the record and the value doesn't trunc or modified.
The max length seems bugged or it is illimitate.
Can you explain me if it is normal and if does exist a real max length? I'm on an Helsinki instance.
Thanks.
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 04:49 AM
Christian,
The field is actually created on database level as 'mediumtext' and the restriction is usually done from application side. FYI:
MEDIUMTEXT [CHARACTER SET
charset_name
] [COLLATE collation_name
]
A TEXT
column with a maximum length of 16,777,215 (224 − 1) characters. The effective maximum length is less if the value contains multibyte characters. EachMEDIUMTEXT
value is stored using a 3-byte length prefix that indicates the number of bytes in the value.
MySQL :: MySQL 5.7 Reference Manual :: 11.1.3 String Type Overview
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2017 09:24 AM
Hi Sergiu,
Can you confirm the following list?
- TINYTEXT 256 bytes
- TEXT 65,535 bytes ~ 64kb
- MEDIUMTEXT 16,777,215 bytes ~ 16MB --> so this is the maximux size for a string type?
- LONGTEXT 4,294,967,295 bytes ~ 4GB
Best Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 12:07 AM
We don't really use all those text types. We use varchar up to 255 and then above that usually mediumtext. So maximum size for a string depends on that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2019 04:30 AM
Dear Sergiu
When does Service Now issue an ALTER TABLE?
We experience the issue that if the Size previously was 40 and then increase to 500, truncation to 40 occurs.
I would have tought that the change of the length causes the system to issue an ALTER TABLE to change to MEDIUMTEXT as you indicated.
Thanks a lot & Best
Daniel
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel