4 ms·
Ask HN: Can I declare varchar like this in an SQL Column?
Hey,
I may be totally wrong here because i'm only a junior and not too sure but I was certain that the maximum varchar() that could be set was 255 varchar(255).
However, i'm working on a database at the moment which was developed by another team and they have varchar(9999).
Is that right? I have had a quick Google but can't find it.
Cheers for advice in advance folks :)
- fasteo 12y agoYou should post this question to stackoverflow.com
- markcrazyhorse 12y agoI thought about that but SO is usually for more detailed questions etc. I have seen similar questions like this be put on hold and slated by the users. However, the above posters have answered my questions :)
- fasteo 12y agoThat´s usually the case if you post poorly written questions, both in content and form, to SO. This is actually a good thing for you, as it forces you to think harder about the problem. And don´t be afraid of SO users. They are there to help and some slating from time to time is good for your soul :)
- onion2k 12y agoNo database has a limit of 255 characters. Varchar limits are; MySQL - 65,535. MS SQL Server 2005 - 8000 (or 2GB if you use varchar(max) ). Oracle 9i - 4000 These are not character limits. They're byte limits. If you're storing multibyte strings (eg unicode-16, emoji, etc) then each character will take up more than one 'space'. But really, asking on HN? This is what StackOverflow is for.
- markcrazyhorse 12y agoI thought about that but SO is usually for more detailed questions etc. I have seen similar questions like this be put on hold and slated by the users
- stephenr 12y agoThe OP is not as wrong as you suggest. Prior to MySQL 5.0.3, varchar was limited to 255 bytes. Also, there is a maximum row length for all columns which is 65,535 bytes, so the practical maximum size for a varchar column is less, unless it's the only column in the table.
- markcrazyhorse 12y agoThanks for the reply - Very Useful