Re: Creating sequences

Поиск
Список
Период
Сортировка
От Adam Lang
Тема Re: Creating sequences
Дата
Msg-id 01e201c00ba3$cb9e5520$330a0a0a@Adam
обсуждение исходный текст
Ответ на Creating sequences  ("Adam Lang" <aalang@rutgersinsurance.com>)
Список pgsql-sql
This is what I wanted to do.  When I can have a primary key that is
meaningful AND won't change, I would like to try to use it, otherwise I'd
probably use an OID.  So... I'm developing a database that will have the
primary key like a "case number" (like when you call for tech support).  Say
your call center has 3 products: Word processor, Spread Sheet, Database.
When you open a case for a product, that product's code will be the
beginning of the case number.  Say, Word processor will be WP00001,
Spreadsheet will be SS00001, etc. (Each product would be in its own table).

Each time a case is opened, it would increment to the next number.

Granted, I could probably just code something where I set up a sequence and
when I do an insert, it concatenates the prefix to the number and then
inserts the value, but I was curious if there was a way where you can set
the initial value to alphanumeric and it will increment from there.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
----- Original Message -----
From: "Gannon, Terry" <Terry.Gannon@trican.ca>
To: "'Adam Lang'" <aalang@rutgersinsurance.com>
Sent: Friday, August 18, 2000 4:15 PM
Subject: RE: [SQL] Creating sequences


> Adam -- suggest that a way to do this would be to use a stored procedure
> that would read the sequence number associated with the table, and build
the
> variable as you require.  You would then setup a trigger that would launch
> the stored procedure everytime you insert a new record into the table?  If
> that's a little foggy, then I would suggest that if you can part with the
> definition of the table that I could put together a little example to
> illustrate...regards...
>
> Terry Gannon
> tgannon@stoneboat.com
>
> > -----Original Message-----
> > From: Adam Lang [SMTP:aalang@rutgersinsurance.com]
> > Sent: Friday, August 18, 2000 12:25 PM
> > To: pgsql-sql@postgresql.org
> > Subject: [SQL] Creating sequences
> >
> > Is it possible to have a sequence (or something like it) when it
> > increments
> > alpha-numeric?
> >
> > Say the first value is set at A01 and it will increment to A02, A03 by
> > default.  Also, it would be good if it could be made the primary key.
> >
> > Adam Lang
> > Systems Engineer
> > Rutgers Casualty Insurance Company



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Franz J Fortuny"
Дата:
Сообщение: Speed or configuration
Следующее
От: "Ingram, Bryan"
Дата:
Сообщение: Re: Best way to create DML/DDL log?