Trouble is I have to import the whole data set into the DB using
SharePoint webpart (which I need to develop later on). I need a way to
simplify this process.

Right now I have imported the Organization data into DB using DT (Data
Transformation). But as I said, when you have a PK on one table that
is being generated by the DB (not done manually) those exact keys need
to match to the rest of the day in the other tables. So if say GUID is
1020 which is generated by the DB, I need to use that GUID in other
table as FK.

Let me see if I can explain it with some sample data

Organization_Table

PK - 1020 (GUID)
OrganizationID (each of them have a unique value) ABC000001

Now in other table Address_Table

PK 2020 (Again GUID)
FK needs to be set to 1020.

I would be putting OrganizationID in sheet that has information about
about the organization. Like OrganizationID, Address_1, Address_2, and
so on.

As I said, I need to import the data right now from excel directly
into DB. I will be scripting this as a class library later that I will
probably use to create a webpart.

So yea I tried the good old method of lmgtfy but didnt find anything
meaning.

On Aug 24, 6:49 pm, Stephen Russell <[email protected]> wrote:
> 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

Reply via email to