pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Creating sequences
2+ messages / 1 participants
[nested] [flat]

* Creating sequences
@ 2000-08-18 18:24 Adam Lang <aalang@rutgersinsurance.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Adam Lang @ 2000-08-18 18:24 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Creating sequences
@ 2000-08-21 19:12 Adam Lang <aalang@rutgersinsurance.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Adam Lang @ 2000-08-21 19:12 UTC (permalink / raw)
  To: Gannon, Terry <Terry.Gannon@trican.ca>; pgsql-sql; +Cc: David Lloyd-Jones <icomm5@attcanada.ca>

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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-08-21 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-08-18 18:24 Creating sequences Adam Lang <aalang@rutgersinsurance.com>
2000-08-21 19:12 Re: Creating sequences Adam Lang <aalang@rutgersinsurance.com>

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