Relating on non primary key


Author
Message
Ian Johnston
Ian Johnston
StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)
Group: StrataFrame Users
Posts: 77, Visits: 470
I am importing lagacy data. I have imported the data using sqlBulkCopy the old data priamry key is a random number entered by the user so they are all over the place. The new tables auto generate the primary keys. I heed to link te two tables on a field containing the old primary key so that I can update the FK with the new PK. I have been looking at the BusinessLayerLinkManager but am not getting anywhere. Is that the way I should be doing this?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Ian.

If I understand what you need, you have a Parent and a Child imported from a legacy database and want to update the Child foreign key with the new Parent PK, is that so? I guess you have the value of the old Parent "primary key" stored in some field in your table, so you could create a Fill Method on your Child table that woud take the Parent table old "primary key" as a parameter and then write the SQL Server statement to fill your Child BO with that(those) record(s) and then change any field contents you would like.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ian, is this a data migration task (i.e. you're doing it or writing a script to handle it one time) or is this something the users need to do as part of normal use of the app?
Ian Johnston
Ian Johnston
StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)
Group: StrataFrame Users
Posts: 77, Visits: 470
Thanks for the input, got it working  using  a lookup on th old key and returning the new one.
Ian Johnston
Ian Johnston
StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)StrataFrame User (151 reputation)
Group: StrataFrame Users
Posts: 77, Visits: 470
This is a one time migration operation. Got it working using Ivan's suggestion.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Glad it helped, Ian. Cool
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search