I would drop the primary key off of your cust_id and add a new field like
customer_id and relink using the old fk.
I'd probably do this by creating a new table and doing an INSERT INTO SELECT
FROM to populate the autoincrement and rename the table.. From there, add
the fk's to your other tables and update those records. I'd probably keep
the cust_id in your primary customer table for tracking purposes..
On 5/9/06, afan@stripped <afan@stripped> wrote:
> hi to all,
> I have to redo a web site of one company and the structure of the current
> db is a little mess.
> one of them is customer id number. right now, customer table use as
> primary key cust_id column varchar(50) PRIMARY KEY (no auto increment). I
> really have no idea why previous developer made cust_id with letter C on
> the beggining of a number, and the number is made from date, (mdyHis) ?!?!
> What do you suggest to do:
> 1. take off letter C and keep the numbers, change cust_id to integer NOT
> NULL, add one customer with number 20000000 and then apply auto_increment?
> 2. replace current Cxxxxxxxxxx with INT numbers and replace the cust_id in
> every other table where cust_id is foreign key?
> 3. something else?
> Thanks for any help!
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: