From: Adam Lang <aalang@rutgersinsurance.com>
To: Gannon, Terry <Terry.Gannon@trican.ca>
To: pgsql-sql@postgresql.org
Cc: David Lloyd-Jones <icomm5@attcanada.ca>
Subject: Re: Creating sequences
Date: Mon, 21 Aug 2000 15:12:47 -0400
Message-ID: <01e201c00ba3$cb9e5520$330a0a0a@Adam> (raw)
References: <309FB895825ED411A32100A0C9B63B1A078BEA@TRICAN4>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: aalang@rutgersinsurance.com, Terry.Gannon@trican.ca, icomm5@attcanada.ca
Subject: Re: Creating sequences
In-Reply-To: <01e201c00ba3$cb9e5520$330a0a0a@Adam>
References: <309FB895825ED411A32100A0C9B63B1A078BEA@TRICAN4> <01e201c00ba3$cb9e5520$330a0a0a@Adam>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox