List:General Discussion« Previous MessageNext Message »
From:Krishna Chandra Prajapati Date:September 9 2008 1:21pm
Subject:Re: DATATYPES
View as plain text  
Hi Brent,

If i need to create a string column of length 1024 which one is best varchar
or text.
Although both support up to 65534 characters.

create table test1(details varchar(65534), roll varchar(100));        (table
cannot be created)
create table test2(details text, roll text);        (table can be created)

Thanks,

On Tue, Sep 9, 2008 at 6:18 PM, Brent Baisley <brenttech@stripped> wrote:

> You pretty much answered your own question. A char will always use the
> same amount of space (the max size), regardless of how little data you
> put in it. A varchar will only use enough space to store the data, so
> the amount of space used for each record will be different. You can
> also specify a max size for varchar. Text is like varchar, but with a
> "fixed" max size of 65,000 characters.
>
> Brent Baisley
>
> On Tue, Sep 9, 2008 at 8:24 AM, Krishna Chandra Prajapati
> <prajapatikc@stripped> wrote:
> > Hi,
> >
> > I would like to know the difference between char, varchar and text.
> >
> > char limit 255 character fixed length
> > varchar limit 65,000 character variable length
> > text limit 65,000 character variable length.
> >
> > --
> > Krishna Chandra Prajapati
> >
>



-- 
Krishna Chandra Prajapati

Thread
DATATYPESKrishna Chandra Prajapati9 Sep
  • Re: DATATYPESTerry Riley9 Sep
  • Re: DATATYPESBrent Baisley9 Sep
    • Re: DATATYPESKrishna Chandra Prajapati9 Sep
  • Re: DATATYPESTerry Riley9 Sep
    • Re: DATATYPESKrishna Chandra Prajapati10 Sep
  • Re: DATATYPESMartijn Tonies9 Sep
    • Re: DATATYPESKrishna Chandra Prajapati10 Sep