scarhand Posted April 5, 2009 Share Posted April 5, 2009 If I create a varchar field with a length/value of 4 will I be able to store data whose length is greater than 4 characters? Example, lets say I make a VARCHAR(4) column. Can I store "i love mysql" in that column without any issues arising? Quote Link to comment https://forums.phpfreaks.com/topic/152666-solved-question-about-lengthvalues/ Share on other sites More sharing options...
corbin Posted April 5, 2009 Share Posted April 5, 2009 No. The length of a VARCHAR(x) column can be any string that has a length <= x. (A CHAR(x) column could be any string with a length of x.) Quote Link to comment https://forums.phpfreaks.com/topic/152666-solved-question-about-lengthvalues/#findComment-801752 Share on other sites More sharing options...
fenway Posted April 6, 2009 Share Posted April 6, 2009 And depending on which sql mode you're running in, you may or may not be told about it. And it gets even more complicated with multi-byte character sets. Quote Link to comment https://forums.phpfreaks.com/topic/152666-solved-question-about-lengthvalues/#findComment-801976 Share on other sites More sharing options...
scarhand Posted April 9, 2009 Author Share Posted April 9, 2009 i ended up just putting the TEXT column in its own table and now the pages execute rediculously faster with 2 queries. Quote Link to comment https://forums.phpfreaks.com/topic/152666-solved-question-about-lengthvalues/#findComment-805204 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.