Re: How do you set a Primary Key when uploading data into a table?

2005-10-11 Thread Gleb Paharenko
Hello.



 The Id row gets values of 99897, and then increments by one.



Please, send the output of:

  SHOW CREATE TABLE sic_codes;



Probably you don't have auto_increment attribute in the Id definition.





Bill Abel wrote:

 How do you load data into a table and generate a primary key which 

 increments by 1.

 

 I want to end up with a primary key value of int 1, 2, 3, 4, and so on.

 

 My table has three rows, Id, Code, Description. I'm loading data from  a

 text file into the table like this:

 

 load data local infile '/Users/billabel/Desktop/sic.txt' into table 

 sic_codes lines

 terminated by '\r' (code, description);

 

 The Id row gets values of 99897, and then increments by one.

 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How do you set a Primary Key when uploading data into a table?

2005-10-10 Thread Bill Abel
How do you load data into a table and generate a primary key which  
increments by 1.


I want to end up with a primary key value of int 1, 2, 3, 4, and so on.

My table has three rows, Id, Code, Description. I'm loading data from  
a text file into the table like this:


load data local infile '/Users/billabel/Desktop/sic.txt' into table  
sic_codes lines

terminated by '\r' (code, description);

The Id row gets values of 99897, and then increments by one.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How do you set a Primary Key when uploading data into a table?

2005-10-10 Thread Bill Abel
How do you load data into a table and generate a primary key which  
auto increments by 1.


I want to end up with a primary key value of int 1, 2, 3, 4, and so on.

My table has three rows, Id (pri_key), Code, Description. I'm loading  
data from a text file into the table like this:


load data local infile 'path_to_myfile.txt' into table sic_codes lines
terminated by '\r' (code, description);

Currently, the Id gets values of 99897, and then increments by one.

Any  help is appreciated.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How do you set a Primary Key when uploading data into a table?

2005-10-10 Thread Fredrick Bartlett
If you are clearing table. Truncate will reset auto_increment to 0

- Original Message - 
From: Bill Abel [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Monday, October 10, 2005 12:10 PM
Subject: How do you set a Primary Key when uploading data into a table?


 How do you load data into a table and generate a primary key which
 auto increments by 1.

 I want to end up with a primary key value of int 1, 2, 3, 4, and so on.

 My table has three rows, Id (pri_key), Code, Description. I'm loading
 data from a text file into the table like this:

 load data local infile 'path_to_myfile.txt' into table sic_codes lines
 terminated by '\r' (code, description);

 Currently, the Id gets values of 99897, and then increments by one.

 Any  help is appreciated.

 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How do you set a Primary Key when uploading data into a table?

2005-10-10 Thread Greg Donald
On 10/10/05, Bill Abel [EMAIL PROTECTED] wrote:
 How do you load data into a table and generate a primary key which
 auto increments by 1.

 I want to end up with a primary key value of int 1, 2, 3, 4, and so on.

 My table has three rows, Id (pri_key), Code, Description. I'm loading
 data from a text file into the table like this:

 load data local infile 'path_to_myfile.txt' into table sic_codes lines
 terminated by '\r' (code, description);

 Currently, the Id gets values of 99897, and then increments by one.

 Any  help is appreciated.


Add an auto_increment option to your Id field.


--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/