Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!husc6!bochner From: bochner@speed.harvard.edu (Harry Bochner) Newsgroups: comp.databases Subject: Re: Unique code numbers Message-ID: Date: 17 Jan 90 20:45:06 GMT References: <1990Jan16.081519.279@cs.eur.nl> Sender: news@husc6.harvard.edu Organization: Aiken Computation Lab, Harvard University Lines: 22 In-reply-to: reino@cs.eur.nl's message of 16 Jan 90 08:15:19 GMT In article <1990Jan16.081519.279@cs.eur.nl> reino@cs.eur.nl (Reino de Boer) writes: I was wondering if there is a relational DBMS that gives me the opportunity to indicate that: 1. SupplierIDs need to be unique 2. PartIDs need to be unique and, most important of all 3. Frees me from the burden to make up new SupplierIDs and PartIDs. INFORMIX's version of SQL has a datatype called 'serial' that does what's needed here: when you add a record, any field of type serial is automatically assigned a unique value. The one thing that's sometimes awkward with this approach is that the 4gl program doesn't know what unique serial key was assigned, and can only find out by selecting the record back from the table. That usually works alright, except that there may not be any other field that's guarranteed to be unique ... -- Harry Bochner bochner@endor.harvard.edu