Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-26-2006, 10:18 AM   #1
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
how do i add ID's to an existing mysql database?

I have this huge database and want to assign a unique number to every record.. how can i do this?

If i create a new field and set it autoincrement it will start counting
for new entries how do i adjust the old entries?
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 10:23 AM   #2
ssp
Confirmed User
 
Join Date: Jan 2005
Location: United Kingdom
Posts: 7,990
How about edit?
ssp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 10:30 AM   #3
JD
Too lazy to set a custom title
 
Industry Role:
Join Date: Sep 2003
Posts: 22,651
they should already have an id.....maybe i'm just misunderstanding something
JD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 10:35 AM   #4
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Quote:
Originally Posted by SPeRMiNaToR
they should already have an id.....maybe i'm just misunderstanding something
I think he's saying he has a table that already has records.
When you alter the table and add a new field, those previous records default to null - where he wants them to get a prepopulated ID from the alter table command. Or something like that.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 11:00 AM   #5
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
This is the only solution I could readily think of.

Your original table:

"table1 ( name, value )"

make a new table with the new ID column set to auto_increment:

"table2 ( id, name, value)"

then run a select into table type query:

INSERT INTO table2 (name,value) SELECT * from table1
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 12:06 PM   #6
s9ann0
Confirmed User
 
Join Date: Sep 2001
Location: Boston
Posts: 4,873
google for "MySQL front" its the shit
s9ann0 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-26-2006, 02:38 PM   #7
VideoJ
Confirmed User
 
Join Date: Aug 2002
Location: S. Florida
Posts: 750
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

or download and install http://www.phpmyadmin.net/home_page/index.php
__________________
Somebody stole my damn signture...
VideoJ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.