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 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?

Hmm, well, I think: not at all.

Unless you implement something like sequences yourself.

MySQL doesn't allow functions to be used in the DEFAULT clause either.

Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com


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

Reply via email to