[URGENT] How to generata a unique string id
Started by Manuel Duran Aguetealmost 25 years ago2 messagesgeneral
Hi,
I need to generate a unique four letters string (p.e
AAAA,AAAB) for any tuple I insert into a table, any idea ? How can I do
this ?
Thanks.
--
Manuel Dur�n Aguete
ALSERNET 2000 S.L
http://www.alsernet.es
Tlf: 902 187 187
Fax: 981 179 121
Re: [URGENT] How to generata a unique string id
From: "Manuel Dur�n Aguete" <mdaguete@alsernet.es>
I need to generate a unique four letters string (p.e
AAAA,AAAB) for any tuple I insert into a table, any idea ? How can I do
this ?
Create a sequence foo_seq and then set your field
create table example (
id default myfunc(nextval(foo_seq)),
a text,
b int4
);
Define myfunc to convert the integer into a character string (take the value
mod 26, append to string, divide value by 26, repeat)
- Richard Huxton