Re: question about varchars
i think it's just a length limiter in serversite (mysql server) string longer than this limit will be cut off allowing you to be lazy to cut it off in clientsite (mysql client) and also a way to indicate the string length, don't have to write a txt file for document >From: "toby -" >To: [EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: Re: question about varchars >Date: Sat, 27 Jul 2002 05:20:01 + > > > > >desmond > >one of my teachers at college once told me to give as less a digit >as possible >that is give it jst a BIT more den i need coz it takes up space >. > >:S ... > >will someone correct me if im rong here . pleez > > >toby > > > > >>Hello there >> >> >>Mysql documentation says the following: >> >>"values are stored using only as many characters as are needed, >>plus one byte to record the length. Values are not padded; instead, >>trailing spaces are removed when values are stored." >> >> >>So, then would there be anything wrong with making all my varchar's >>up to 255. That is defining most of my fields to be varchar(255) >>even when i know they may only go 100? >> >>Thanks >> >>Desmond >> >> >> >> >> >>_ >>Send and receive Hotmail on your mobile device: >>http://mobile.msn.com >> >> >>- >>Before posting, please check: >> http://www.mysql.com/manual.php (the manual) >> http://lists.mysql.com/ (the list archive) >> >>To request this thread, e-mail >>To unsubscribe, e-mail >> >>Trouble unsubscribing? Try: >>http://lists.mysql.com/php/unsubscribe.php > > > > >_ >Chat with friends online, try MSN Messenger: >http://messenger.msn.com > > >- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail >To unsubscribe, e-mail > >Trouble unsubscribing? Try: >http://lists.mysql.com/php/unsubscribe.php _ ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger: http://messenger.microsoft.com/cn - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: question about varchars
desmond one of my teachers at college once told me to give as less a digit as possible that is give it jst a BIT more den i need coz it takes up space . :S ... will someone correct me if im rong here . pleez toby >Hello there > > >Mysql documentation says the following: > >"values are stored using only as many characters as are needed, plus one >byte to record the length. Values are not padded; instead, trailing spaces >are removed when values are stored." > > >So, then would there be anything wrong with making all my varchar's up to >255. That is defining most of my fields to be varchar(255) even when i know >they may only go 100? > >Thanks > >Desmond > > > > > >_ >Send and receive Hotmail on your mobile device: http://mobile.msn.com > > >- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail ><[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php _ Chat with friends online, try MSN Messenger: http://messenger.msn.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: question about varchars
Your application uses the field size and type to validate the data BEFORE sending it to MySQL. Norris, Joseph wrote: >Hello, > > >What you say below is of great interest to me. Currently I have been >writing front end code to handle the size >issue but I would like to be open to other possibilities. So my question >about your answer below is: > >Just how does the developer obtain the error condition from Mysql when an >insert >or update sends data that is too long to a field with a restricted size? > >Thanks > > >-Original Message- >From: Ralf Narozny [mailto:[EMAIL PROTECTED]] >Sent: Thursday, July 25, 2002 1:59 AM >To: Desmond Lee >Cc: [EMAIL PROTECTED] >Subject: Re: question about varchars > > >Hello! > >Desmond Lee wrote: > >>Hello there >> >> >>Mysql documentation says the following: >> >>"values are stored using only as many characters as are needed, plus >>one byte to record the length. Values are not padded; instead, >>trailing spaces are removed when values are stored." >> >> >>So, then would there be anything wrong with making all my varchar's up >>to 255. That is defining most of my fields to be varchar(255) even >>when i know they may only go 100? >> > > >There's nothing wrong with it for storage reasons only, but many >database developers use lengths to restrict the size of the entries. For >example storing the zipcodes from more than one country might need at >max 15 characters, so why allowing 255, preventing MySQL to raise an >error, if the ZIP is 100 chars long. > >Greetings > Ralf > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: question about varchars
Hello, What you say below is of great interest to me. Currently I have been writing front end code to handle the size issue but I would like to be open to other possibilities. So my question about your answer below is: Just how does the developer obtain the error condition from Mysql when an insert or update sends data that is too long to a field with a restricted size? Thanks -Original Message- From: Ralf Narozny [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 25, 2002 1:59 AM To: Desmond Lee Cc: [EMAIL PROTECTED] Subject: Re: question about varchars Hello! Desmond Lee wrote: > Hello there > > > Mysql documentation says the following: > > "values are stored using only as many characters as are needed, plus > one byte to record the length. Values are not padded; instead, > trailing spaces are removed when values are stored." > > > So, then would there be anything wrong with making all my varchar's up > to 255. That is defining most of my fields to be varchar(255) even > when i know they may only go 100? There's nothing wrong with it for storage reasons only, but many database developers use lengths to restrict the size of the entries. For example storing the zipcodes from more than one country might need at max 15 characters, so why allowing 255, preventing MySQL to raise an error, if the ZIP is 100 chars long. Greetings Ralf -- Ralf Narozny SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: question about varchars
Desmond, Thursday, July 25, 2002, 2:42:31 AM, you wrote: DL> Mysql documentation says the following: DL> "values are stored using only as many characters as are needed, plus one DL> byte to record the length. Values are not padded; instead, trailing spaces DL> are removed when values are stored." DL> So, then would there be anything wrong with making all my varchar's up to DL> 255. That is defining most of my fields to be varchar(255) even when i know DL> they may only go 100? If you have indexes on your whole columns, index on varchar(255) is bigger, than on varchar(100). -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: question about varchars
Hello! Desmond Lee wrote: > Hello there > > > Mysql documentation says the following: > > "values are stored using only as many characters as are needed, plus > one byte to record the length. Values are not padded; instead, > trailing spaces are removed when values are stored." > > > So, then would there be anything wrong with making all my varchar's up > to 255. That is defining most of my fields to be varchar(255) even > when i know they may only go 100? There's nothing wrong with it for storage reasons only, but many database developers use lengths to restrict the size of the entries. For example storing the zipcodes from more than one country might need at max 15 characters, so why allowing 255, preventing MySQL to raise an error, if the ZIP is 100 chars long. Greetings Ralf -- Ralf Narozny SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
question about varchars
Hello there Mysql documentation says the following: "values are stored using only as many characters as are needed, plus one byte to record the length. Values are not padded; instead, trailing spaces are removed when values are stored." So, then would there be anything wrong with making all my varchar's up to 255. That is defining most of my fields to be varchar(255) even when i know they may only go 100? Thanks Desmond _ Send and receive Hotmail on your mobile device: http://mobile.msn.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
question about varchars
Hello there Mysql documentation says the following: "values are stored using only as many characters as are needed, plus one byte to record the length. Values are not padded; instead, trailing spaces are removed when values are stored." So, then would there be anything wrong with making all my varchar's up to 255. That is defining most of my fields to be varchar(255) even when i know they may only go 100? Thanks Desmond _ Chat with friends online, try MSN Messenger: http://messenger.msn.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php