Re: Can mSQL AUTO-INCREMENT a field with each INSERT to a table?

From: Ing. Juan Carlos Fernandez-B (juan@linux.form-net.com)
Date: Mon Oct 04 1999 - 22:54:20 EST


Hello Christopher,
you can see the msql manual, if you see the create clause you see how to
create sequences:
CREATE SEQUENCE ON table1 Step 1 Value 5
this will create a sequence on the table1 incrementing every time 1 and
starting on 5.
then when you want to increment the seq you just have to do the following
select:
SELECT _seq FROm test
cheers
Juan Carlos

On Mon, 4 Oct 1999, Christopher Stephens wrote:

> >Yupp, in msql you have to create a sequence on a table and do a select _seq
> >from table to get the next value from the sequence. This has the advantage
> >that you get a truly ascending sequence of numbers. As far as i know,
> >mysqls auto increment fields "reuse" numbers from records that have been
> >deleted.
>
>
> Sorry Greg, but I didn't understand this answer, apart from realising that
> what I want to do is possible (ie to turn an empty field in a large table
> into an ascending sequence of numbers).
> Can you give me concrete examples of how this would be done or point me at
> some appropriate documentation please?
>
> Many thanks, and sorry for being so dense.
>
> Chris
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "Information is not knowledge...." | Chris Stephens
> | Humanities Computing Unit
> +44 1865 283 295 | OUCS
> http://www.hcu.ox.ac.uk/ | Oxford OX2 6NN
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> -------------------------------------------------------------------------
> To unsubscribe, go to http://www.Hughes.com.au/extras/email/
>

-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/



This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:03:51 EST