How about creating a temp table TempClients BadID INT GoodID INT Insert the BAD records Key in the correct numbers against the bad ones to be replaced
UPDATE FKtable SET ClientID = t1.GoodID FROM TempClients t1, FKtable t2 WHERE t2.ClientID = t1.BadID "David Ebert" <[EMAIL PROTECTED]> wrote: >I had some temporary data entry operators inputing to a new database >with some interesting results. �If a client is readmitted they would >enter a new client record and append either a '2' or a '?' to the last >name, i.e., Dave Ebert, Dave Ebert2, Dave Ebert? > >The client record is the top level of a pyramid structure. �Below the >client is the admission record (many-to-one), and all records pertaining >to the admission refer to the admission record's PK. > >I want to assign the admission record's PK to the FK records, but >transfer the admission record to the first client record. �No problem as >I'm only talking about 60 or so records. > >However, the client ID is used as a reference in most of the detail >tables (assessments, services, outcomes, etc.) potentially 18 tables in >all. �Reassigning those client numbers involves finding out if a record >by a given client number exists, and if so to update it to the correct >ID. �This may need to be done for up to two spurious ID numbers. > >I can to a series of updates to revise the ID number, but how would I do >this aside from picking through the candidate tables one at a time? > >I'd appreciate any pointers. > >tia > >Dave Ebert >Dave Ebert2 >Dave Ebert? >Huckleberry House > -- Albert Berry Full Time Consultant to PSD Solutions 350 West Hubbard, Suite 210 Chicago, IL 60610 312-828-9253 Ext. 32 __________________________________________________________________ The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ ================================================ TO SEE MESSAGE POSTING GUIDELINES: Send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: INTRO rbase-l ================================================ TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED] In the message body, put just two words: UNSUBSCRIBE rbase-l ================================================ TO SEARCH ARCHIVES: http://www.mail-archive.com/rbase-l%40sonetmail.com/
