Gossamer Forum
Home : General : Databases and SQL :

Creating table with a TEXT column.

Quote Reply
Creating table with a TEXT column.
This always gives me trouble.

Can anyone see the problem with this?

CREATE TABLE Posts(
post_id INT(10) NOT NULL ,
post_ticket_id INT(6) NOT NULL ,
post_subject VARCHAR(255) NULL ,
post_body TEXT(1000) NOT NULL ,
post_timestamp INT(15) NOT NULL ,
PRIMARY KEY (post_id),
UNIQUE (post_id)
)

Last edited by:

Paul: May 28, 2002, 12:30 PM
Quote Reply
Re: [Paul] Creating table with a TEXT column. In reply to
Hmm can you not use a length with TEXT?

I had to use:

post_body TEXT NOT NULL ,
Quote Reply
Re: [Paul] Creating table with a TEXT column. In reply to
Hi Paul,

That makes sense...

TEXT columns automatically have a max char length of 65535.

Compare to...

TINYTEXT: 255 chars
MEDIUMTEXT: 16777215 chars
LONGTEXT: 4294967295 chars

--
Matt G
Quote Reply
Re: [Matt Glaspie] Creating table with a TEXT column. In reply to
Yeah, I just thought I could set a max length though like with VARCHAR (which has a 255 max but you can still set it lower)...guess it isn't possible though :(

Last edited by:

Paul: Jun 19, 2002, 3:31 PM
Quote Reply
Re: [Paul] Creating table with a TEXT column. In reply to
Paul, I have had probs with this too, and finally arrived at the conclusion that you can't set length with TEXT.... thats where i use CHAR (1000) instead. (or VARCHAR)


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jun 19, 2002, 4:17 PM
Quote Reply
Re: [Ian] Creating table with a TEXT column. In reply to
CHAR(1000) ?

>>
The length of a CHAR column is fixed to the length that you declare when you create the table. The length can be any value between 1 and 255.
<<

It doesn't look like you can do 1000, but also I don't like the padding in CHAR columns :(
Quote Reply
Re: [Paul] Creating table with a TEXT column. In reply to
Yeah, true.. I havn't seen anything about CHAR(255) yet.... hmmmm


http://www.iuni.com/...tware/web/index.html
Links Plugins