SEQUENCES

2003-12-15 Thread Graham Little
I was wondering whether it was possible to make and AUTO_INCREMENT
field instead of always adding 1 and starting at zero, into a SEQUENCE 
type field so that it is say a 10 digit integer and numbers are created 
according to the SEQUENCE.

thanks
Graham


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


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



LOAD DATA INFILE..

2003-12-15 Thread Graham Little
Hi everyone,

I am currently trying to run the following command:

LOAD DATA INFILE D:\mysql\sql\CountryData.txt 
INTO TABLE cou
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\r\n'
(id, country);

Example data in file is:

country, id
AFGHANISTAN,4
ALBANIA,8
ALGERIA,12
AMERICAN SAMOA,16
ANDORRA,20
ANGOLA,24

The table the data is being inserted into is:

+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| cou_id   | int(11) |  | PRI | 0   |   |
| cou_name | text|  | | |   |
+--+-+--+-+-+---+

I am getting the following error message and i am not
sure why?

Error 1054: Unknown column 'id' in 'field list'


Any help would be appreciated.

Thanks

Graham 


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


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



RE: SEQUENCES

2003-12-15 Thread Graham Little
I looked in the documentation but could not find any mention of
SEQUENCES. The AUTO_INCREMENT documentation seems to say that you
can change a server variable to adjust the incremented count, but
unless i can put an equation into their, i don't see how changing
that would help.

thanks
Graham

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: 15 December 2003 14:03
To: Graham Little; [EMAIL PROTECTED]
Subject: RE: SEQUENCES


[snip]
I was wondering whether it was possible to make and AUTO_INCREMENT
field instead of always adding 1 and starting at zero, into a SEQUENCE 
type field so that it is say a 10 digit integer and numbers are created 
according to the SEQUENCE.
[/snip]

I was wondering if you had tried it in a test table.


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


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



RE: SEQUENCES

2003-12-15 Thread Graham Little
Hi Chris, 

Thanks for your help, i will find another way around it.

Graham

-Original Message-
From: Chris Nolan [mailto:[EMAIL PROTECTED]
Sent: 15 December 2003 14:13
To: Graham Little
Cc: '[EMAIL PROTECTED]'
Subject: Re: SEQUENCES


Hi,

As far as I know, definitely not. However, you could use an 
AUTO_INCREMENT field as the independent variable
for some application-level function you use to generate the values in 
the sequence.

Best regards,

Chris

Graham Little wrote:

I was wondering whether it was possible to make and AUTO_INCREMENT
field instead of always adding 1 and starting at zero, into a SEQUENCE 
type field so that it is say a 10 digit integer and numbers are created 
according to the SEQUENCE.

thanks
Graham


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


  



This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


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



RE: LOAD DATA INFILE..

2003-12-15 Thread Graham Little
That is brilliant thank you. I was doing it the wrong way 
around when i was naming the fields.

Thank you for your help
graham

-Original Message-
From: Tobias Asplund [mailto:[EMAIL PROTECTED]
Sent: 15 December 2003 14:46
To: Graham Little
Cc: '[EMAIL PROTECTED]'
Subject: Re: LOAD DATA INFILE..


On Mon, 15 Dec 2003, Graham Little wrote:

doing selective quoting below.

   LOAD DATA INFILE D:\mysql\sql\CountryData.txt
   INTO TABLE cou (id, country);

See how you try to load from a file into the columns id and country in the
cou table?

 The table the data is being inserted into is:

   +--+-+--+-+-+---+
   | Field| Type| Null | Key | Default | Extra |
   +--+-+--+-+-+---+
   | cou_id   | int(11) |  | PRI | 0   |   |
   | cou_name | text|  | | |   |
   +--+-+--+-+-+---+


And those columns doesn't exist.

 I am getting the following error message and i am not
 sure why?

   Error 1054: Unknown column 'id' in 'field list'


 Any help would be appreciated.


Hope that helps.


This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com


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