Page 1 of 1

MySQL INT & TINYINT

Posted: Tue Nov 05, 2002 11:16 pm
by jstrellner
Hello,

I am not sure if this is the correct place to post this but it looks like it. I have a problem. I have created a new MySQL DB and when I created it I used TINYINT, unfortunately I didn't realized that it limited the DB to 127 records. I have searched online and found that I should have used INT because it doesn't have the 127 record limit. The question I have now is, is there a way to change it from TINYINT to INT?

I have already existing data that I would like to avoid loosing, can I just update it in some way and not effect the DB?

I have included a copy of the original dump file:

Code: Select all

CREATE TABLE quotes (  id tinyint(21) DEFAULT '0' NOT NULL AUTO_INCREMENT,
quoteid varchar(6), quotedate varchar(12), quotetime varchar(11),
quoteamount varchar(8), quotepromo varchar(20), quotelogo varchar(3),
quotehosting varchar(3), quotedomainreg varchar(3),
quotewebdesign varchar(3), quotewebdesigntype varchar(30),
quoteseoss varchar(3), quotepage varchar(3), quotepagesother varchar(3),
quotelayout varchar(3), quotename varchar(50), quoteemail varchar(50),
quotestartdate varchar(20), quotecompletein varchar(10),
quotenotes varchar(255), quoteua varchar(255), quoteip varchar(16),
PRIMARY KEY (id),  UNIQUE id (id));


If there are any other errors please let me know.

Thanks,

Posted: Wed Nov 06, 2002 4:48 am
by DoppyNL
just change the field to a normal integer.
MySQL will maintain the data when possible, since going from tinyint to int will only allow more numbers the data should be maintained without any problem.

you can use a "alter table" query, or just use phpmyadmin wich makes it VERY easy to change things.

Greetz Daan

Posted: Wed Nov 06, 2002 9:19 am
by jstrellner
Thanks,

I did however just loose all the data and start over because I couldn't leave it like it was. :cry:

For future reference how would I use the "alter table" query? I am assuming that I could use this to change the names of the table too.

Thank you.

Posted: Wed Nov 06, 2002 12:33 pm
by DutchBen