Unique serial numbers

Frank Engel fde101 at fjrhome.net
Wed Nov 10 11:24:58 EST 2004


Depending on your DBMS, this functionality might be built-in to the 
database server.  For example. PostgreSQL offers sequences, as well as 
a virtual data type "SERIAL" which abstracts the sequences to provide 
exactly what you are asking for.  Other database systems should have 
similar facilities, although they are not really standardized.

A quick PostgreSQL example:

CREATE TABLE sometable
(
     mySerial    SERIAL
);


PostgreSQL will automatically assign a unique value to the mySerial 
field for each new record.

On Nov 10, 2004, at 10:54, MisterX wrote:

> Greg,
>
> You can easily test of a duplicate with an index...
>
> You can also keep track of the last used record and increment it.
>
> If you want a permanent record, something like the saving of a small 
> file
> should do.
>
> Last but not least, combining the id with another thing like the file 
> name
> or a unique database identifier can help enhance uniqueness further...
>
> Is it possible that two clients create to records at the same time? 
> Sooner
> or later, this could happen.
>
> Cheers
> Xavier
>
>> -----Original Message-----
>> From: use-revolution-bounces at lists.runrev.com
>> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of
>> Gregory Lypny
>> Sent: Wednesday, November 10, 2004 16:34
>> To: Revolution
>> Subject: Unique serial numbers
>>
>> Hello everyone,
>>
>> I want to assign a unique serial number of each record
>> created using a Rev CGI, and I'm wondering whether the long
>> seconds at the time of record creation would fit the bill.
>>
>> 	Greg
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten 
Son, that whosoever believeth in him should not perish, but have 
everlasting life.
$



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list