Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

MySQL INT & TINYINT

Codes here !

Moderators: macek, egami, gesf

MySQL INT & TINYINT

Postby jstrellner » Tue Nov 05, 2002 11:16 pm

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,
jstrellner
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Nov 05, 2002 11:05 pm
Location: Las Vegas, NV

Postby DoppyNL » Wed Nov 06, 2002 4:48 am

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
DoppyNL
 

Postby jstrellner » Wed Nov 06, 2002 9:19 am

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.
jstrellner
New php-forum User
New php-forum User
 
Posts: 6
Joined: Tue Nov 05, 2002 11:05 pm
Location: Las Vegas, NV

Postby DutchBen » Wed Nov 06, 2002 12:33 pm

DutchBen
New php-forum User
New php-forum User
 
Posts: 36
Joined: Thu Oct 24, 2002 10:28 am
Location: Amsterdam


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.