--- Brian E Boothe <[EMAIL PROTECTED]> wrote: > i have a cusid "customer-id feild" for a customer id number > we already have customers in 120 of those tables, > how can i auto generate CusID numbers for Exsisting Customers
Are you using MySQL? I'll work under the assumption that you are. Is the cusid field type INT? Does it have the PRIMARY KEY and AUTO_INCREMENT set? If it is only INT and you have values, your best bet may be to use mysqldump from the Linux command line and export the table to a file. Edit the SQL that defines the table to include the PRIMARY KEY and AUTO_INCREMENT features. Import the file with mysql [connection info] < file.sql It may be possible to use an ALTER TABLE statement to change the column properties and add the automatically numbered fields. If you are starting from scratch, you can define the tables pretty simply with an SQL query like: CREATE TABLE tablename ( cusid INT PRIMARY KEY AUTO_INCREMENT, fname VARCHAR(255), lname VARCHAR(255), email VARCHAR(255) ); Naturally you will want to modify this to use whatever fields you need. Note that you can get by with a lot less than you will see in a mysqldump output. Values you don't specify will get the MySQL defaults. When inserting a row of data into this table, insert a 0 into cusid to trigger the auto_increment feature--one more than the highest value which has been used in that table column. I hope you don't really mean "120 of those tables" but rather "120 of those rows". It's an easy mistake to make but specific use of the correct terms helps communicate what you are doing and what you want to accomplish. James
