Unix Technical Forum

Limiting the text size on text fields

This is a discussion on Limiting the text size on text fields within the MySQL General forum forums, part of the MySQL category; --> Is there a way to restrict the length of text field in MySQL. For example, it is of 65K ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:01 AM
Ganesh's screen
 
Posts: n/a
Default Limiting the text size on text fields


Is there a way to restrict the length of text field in MySQL. For example, it
is of 65K limit and could hold more than 20000 characters. Is there a way to
restrict that to 4000 characters at table/field level. Coz the
max_allowed_packet constrainted the entire DB.

Thanks
Ganesh
--
View this message in context: http://www.nabble.com/Limiting-the-t...html#a13213842
Sent from the MySQL - General mailing list archive at Nabble.com.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:01 AM
Sebastian Mendel
 
Posts: n/a
Default Re: Limiting the text size on text fields

Ganesh's screen schrieb:
> Is there a way to restrict the length of text field in MySQL. For example, it
> is of 65K limit and could hold more than 20000 characters. Is there a way to
> restrict that to 4000 characters at table/field level. Coz the
> max_allowed_packet constrainted the entire DB.


you can specify the maximum length only on these field types:

CHAR(length)
VARCHAR(length)
BINARY(length)
VARBINARY(length)

--
Sebastian

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 07:01 AM
Ganesh's screen
 
Posts: n/a
Default Re: Limiting the text size on text fields


Thank you, Sebastian. Also does the usage of UTF-8 over Latin1 restraints the
usage or extensibility?


Sebastian Mendel wrote:
>
> Ganesh's screen schrieb:
>> Is there a way to restrict the length of text field in MySQL. For
>> example, it
>> is of 65K limit and could hold more than 20000 characters. Is there a way
>> to
>> restrict that to 4000 characters at table/field level. Coz the
>> max_allowed_packet constrainted the entire DB.

>
> you can specify the maximum length only on these field types:
>
> CHAR(length)
> VARCHAR(length)
> BINARY(length)
> VARBINARY(length)
>
> --
> Sebastian
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@nabble.com
>
>
>


--
View this message in context: http://www.nabble.com/Limiting-the-t...html#a13273514
Sent from the MySQL - General mailing list archive at Nabble.com.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:28 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com