List:General Discussion« Previous MessageNext Message »
From:Luca Ferrari Date:January 2 2007 1:54pm
Subject:sequences and auto_increment
View as plain text  
Hi all,
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 DEFAULT ('comp-06-'::text || 
(nextval('sequenza_competenza'::regclass))::text),
  descrizione character varying(100),
  CONSTRAINT competenza_pkey PRIMARY KEY (id_competenza)
) 

there, id_competenza is compound by a string "comp-06" and the next value of a 
sequence (similar to auto_increment). In MySQL there're no sequences, or 
better, there's only an auto_increment action on an int field. How can I 
obtain the same effect of the concatenation of a sequence and a string?

Thanks,
Luca
Thread
sequences and auto_incrementLuca Ferrari2 Jan
  • Re: sequences and auto_incrementMartijn Tonies2 Jan
  • Re: sequences and auto_incrementBrent Baisley2 Jan
    • Re: sequences and auto_incrementLuca Ferrari2 Jan
      • Re: sequences and auto_incrementKen Brown2 Jan
  • Re: sequences and auto_incrementMartijn Tonies2 Jan