Re: sequences and auto_increment

2007-01-02 Thread Martijn Tonies
Hi, I'm new to MySQL coming from PostgreSQL backgroud. I'd like to know how to obtain the same effect of a sequence + concat as default value of a table in mysql. For example, consider the following table definition: CREATE TABLE competenza ( id_competenza character varying(30) NOT NULL

Re: sequences and auto_increment

2007-01-02 Thread Brent Baisley
I don't think MySQL has exactly what you are looking for, but you may be able to get the behavior you want. The auto_increment value is actually based on an index and doesn't have to be unique. So you could create a compound index that has one or more fields plus the auto_increment field. The

Re: sequences and auto_increment

2007-01-02 Thread Luca Ferrari
On Tuesday 02 January 2007 16:51 Brent Baisley's cat, walking on the keyboard, wrote: CREATE TABLE competenza ( competenza varchar(30) NOT NULL default 'comp-06-', id_competenza int unsigned not null auto_increment, descrizione varchar(100), PRIMARY KEY (competenza, id_competenza) )

Re: sequences and auto_increment

2007-01-02 Thread Martijn Tonies
Hi, CREATE TABLE competenza ( competenza varchar(30) NOT NULL default 'comp-06-', id_competenza int unsigned not null auto_increment, descrizione varchar(100), PRIMARY KEY (competenza, id_competenza) ) Since your PRIMARY KEY is a combination of 2 fields (competenza +

Re: sequences and auto_increment

2007-01-02 Thread Ken Brown
I had a similar problem a while ago and I got round it by using a trigger - called a function on an insert to read a value from a table (use for update when selecting) update with incremented value then use the return value from the ffunction to set the new value - you can do all your login or

Re: sequences

2006-03-21 Thread Martijn Tonies
Hello Chad, Does mysql have sequences? No, it does not. If not what is the functional equivalent? auto-increment would be the closest. Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle MS SQL Server Upscene Productions http://www.upscene.com My thoughts:

Re: Sequences and Synomyms

2004-10-19 Thread Martijn Tonies
Hello, I am new to mysql. I want to create sequences in mysql 4.0 which should be equivalent to oracle sequences. I gone through the mysql manual, Auto_Increment(), C API mysql_insert_id() and LAST_INSERT_ID() are there for sequences. Last_insert_id() gives the last value. I want actual

RE: SEQUENCES

2003-12-15 Thread Jay Blanchard
[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

Re: SEQUENCES

2003-12-15 Thread Chris Nolan
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

RE: SEQUENCES

2003-12-15 Thread Graham Little
-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

RE: SEQUENCES

2003-12-15 Thread Peter Lovatt
Try Insert INTO `table` ( `inc_field` ) values (10) the auto inc field will then generate the next sequential numbers HTH Peter -Original Message- From: Graham Little [mailto:[EMAIL PROTECTED] Sent: 15 December 2003 14:01 To: '[EMAIL PROTECTED]' Subject: SEQUENCES I was

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

RE: SEQUENCES

2003-12-15 Thread Tobias Asplund
On Mon, 15 Dec 2003, Peter Lovatt wrote: Try Insert INTO `table` ( `inc_field` ) values (10) the auto inc field will then generate the next sequential numbers HTH Peter Or just use ALTER TABLE table AUTO_INCREMENT=10 That way you don't have to enter a record just to set

Re: sequences or auto_increment column????

2001-07-27 Thread Dennis Salguero
I prefer to use Auto_Increment for ease of use. In addition, I don't think that MySQL supports sequences outright (like you may be used to with Oracle). There are some workarounds availabe within the MySQL manual, do a search with sequences. Good Luck, Dennis