Re: Renumbering Database Records
This WebDNA talk-list message is from 1999
It keeps the original formatting.
numero = 23722
interpreted = N
texte = > How can I renumber the records in a database? I have a database with a>field ID. I want to go throught the database, possibly sorting on some>other field, and number the records 1,2,3,4,... etc so I can have a>unique ID for each record. After that, for example, I can use this ID to>delete a record.It almost sounds like your field ID is *already* the unique ID you'relooking for. Is it not?You're adding numbers to something that doesn't already have uniqueidentifiers in it? The tough part there is going to be figuring out how touniquely determine which record you want to modify. For instance, the[Replace] context which you'll be using for your renumbering task needs tobe given a set of search criteria that uniquely identify the record. Ifyou give it something non-unique to search for, then it will end uprenumbering all found records with the *same* number.So your task is to come up with a search that will always find just onerecord. Once you can do that, you can use a little [math] to increment anumber once for each found record, then [replace] the sku with that number.Technical Support | ==== eCommerce and Beyond ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
Associated Messages, from the most recent to the oldest:
> How can I renumber the records in a database? I have a database with a>field ID. I want to go throught the database, possibly sorting on some>other field, and number the records 1,2,3,4,... etc so I can have a>unique ID for each record. After that, for example, I can use this ID to>delete a record.It almost sounds like your field ID is *already* the unique ID you'relooking for. Is it not?You're adding numbers to something that doesn't already have uniqueidentifiers in it? The tough part there is going to be figuring out how touniquely determine which record you want to modify. For instance, the
[replace] context which you'll be using for your renumbering task needs tobe given a set of search criteria that uniquely identify the record. Ifyou give it something non-unique to search for, then it will end uprenumbering all found records with the *same* number.So your task is to come up with a search that will always find just onerecord. Once you can do that, you can use a little
[math] to increment anumber once for each found record, then
[replace] the sku with that number.Technical Support | ==== eCommerce and Beyond ====Pacific Coast Software | WebCatalog, WebMerchant,11770 Bernardo Plaza Court | SiteEdit Pro, PhotoMaster,San Diego, CA 92128 | Typhoon619/675-1106 Fax: 619/675-0372 | http://www.smithmicro.com/
PCS Technical Support
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Ken's Data Manager (finally available I think ...) (2005)
Trouble with Showif and Search (1998)
[WebDNA] [thisurl] not clean on fastcgi 7 (2010)
database paths/names, and a typo (1997)
Lost Field (1998)
Document Contains No Data! (1997)
[WebDNA] Searching using variable or numeric number (2019)
CC Payment Processors (2007)
WebCatalog for guestbook ? (1997)
BBEdit and WebCatalog 2.0? (1997)
remove line item (2000)
SAVECART (1997)
WC2b15 File Corruption (1997)
Prevent multiple appends with Reload Button (1997)
[tcp connect] (1998)
SV: Mass Mail (2000)
Smart caching problems with 2.1b3? (1997)
OT: zipcodes (2002)
Limiting user access to .tmpl files (1997)
Sorting by date (1997)