On Tue, Aug 24, 2010 at 8:36 AM, S <[email protected]> wrote: > Hello all, > > I think I have this complicated situation which I will try > to explain the best I can. I have say an excel sheet with data. This > data will go in a table whose primary key is going to be guid value > (Dont ask, I didnt get to say whether it was a good idea or not). It > also has another ID which can be used to track information related to > it. > > Organization table > > Id -- PK - GUID > Org_ID (some string value) > Org_Name > and so on and so forth > > Another Table (Not my choice of design, so wont be able to change it) > > Address table (In excel sheet would have a Org_ID to relate to which > Org we are referring to) > > Id -- PK - GUID > Address_Org > > and so on and so forth > > So Organization.Org_ID = Address.Org_ID > > But all of this data is in excel sheet and it is going to be received > in excel sheet even in future from some service. > > I can upload the data in Organization table without any issues as in > this table there are no FK. But the other tables have used the PK of > Organization as the FK. How do I go about writing some code that will > look for say Organization.Org_ID in the excel sheet, take the > corresponding records for Address table and insert all the fields from > the sheet along with the PK of Organization table as FK of Address > table. > > I hope I was able to make this as clear as possible so that someone > can help me resolving this issue. Thanks for all the help in advance. -------------------
Sounds like they have a good design why are you having troubles? So what are you having an issue with? "How do I go about writing some code that will > look for say Organization.Org_ID in the excel sheet, take the > corresponding records for Address table and insert all the fields from > the sheet along with the PK of Organization table as FK of Address > table." How to read a spreadsheet? What type of environment are you working with? Web or Winforms would be helpful. What version of Excel will the "process" be run on? 2003, 2007, 2010? Have you googled this or do you need a lmgtfy? -- Stephen Russell Sr. Production Systems Programmer CIMSgts 901.246-0159 cell
