home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / 6551 < prev    next >
Encoding:
Internet Message Format  |  1992-09-04  |  1.5 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!emory!ncratl!hroth
  2. From: hroth@ncratl.AtlantaGA.NCR.COM (Harris Roth)
  3. Newsgroups: comp.databases
  4. Subject: Re: Yet Another Simple (?) Question on Paradox
  5. Keywords: Unique Record Field, Paradox
  6. Message-ID: <8966@ncratl.AtlantaGA.NCR.COM>
  7. Date: 4 Sep 92 14:31:08 GMT
  8. References: <1992Aug31.195806.13243@murdoch.acc.Virginia.EDU>
  9. Distribution: na
  10. Organization: NCR Engineering and Manufacturing Atlanta -- Atlanta, GA
  11. Lines: 29
  12.  
  13. In article <1992Aug31.195806.13243@murdoch.acc.Virginia.EDU> cyj9h@csissun12.ee.Virginia.EDU (Charles Y. Choi) writes:
  14. >Here's a question that I've yet to figure out.  When creating a new record,
  15. >how can you get a field in that record (say ID) to automatically be filled
  16. >in with the record number?  For example
  17. >
  18. >So what do I want?  All I really want to do is have an automated
  19. >way of generating a unique ID for each record period.
  20. >
  21. >Can anybody here help?
  22. >
  23. >-Charles Y. Choi
  24.  
  25. If Nrecords( "Table") = 0 Then    ; no records yet?
  26.  id = 1                           ; first id
  27. Else
  28.  id = Cmax( "Table", "ID") + 1    ; largest id + 1
  29. EndIf
  30.  
  31. This will guarantee a unique id for each record regardless of the number
  32. of records added or deleted.  There will be not be a coordination between
  33. the record number and the ID but, why do you need that anyway?
  34.  
  35.  
  36.  
  37. -- 
  38. Harris J. Roth, Senior Programmer Analyst |
  39. System Software                           |   hroth@ncratl.atlantaga.NCR.COM 
  40. Transaction Terminal Systems Division     |
  41. NCR E&M Atlanta                           |
  42.