[GENERAL] serial data type usage

2008-11-06 Thread EXT-Rothermel, Peter M
I have a table where I would like the primary key to be generated during the insert. Here is a simplified example: CREATE TABLE employee_type { tname varchar(10) PRIMARY KEY, id_prefix char(1) ; ... } tname | id_prefix --+-- worker | W manager | M

Re: [GENERAL] serial data type usage

2008-11-06 Thread Alan Hodgson
On Thursday 06 November 2008, EXT-Rothermel, Peter M [EMAIL PROTECTED] wrote: I have thought about using the serial data type for the employee.id but I also want to automate the prepending of the { W, M, E } prefix. You'll need write a before-insert trigger to assign the ID. -- Alan --

Re: [GENERAL] serial data type usage

2008-11-06 Thread Berend Tober
EXT-Rothermel, Peter M wrote: I have a table where I would like the primary key to be generated during the insert. Here is a simplified example: CREATE TABLE employee_type { tname varchar(10) PRIMARY KEY, id_prefix char(1) ; ... } tname | id_prefix --+--