On Tue, Aug 24, 2010 at 10:28 AM, S <[email protected]> wrote:
> 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.
-------------------------

Sounds like the GUID values is not there but a look up column is
actually present in the sheet.  If that is the case QUERY the blasted
table to get the GUID needed.  Not that tough from my POV.   That sets
Organization PK which in turn is used as the FKey in Address_Table

If you do NOT have the lookup for Org's but do in fact only have
address data well Look up from Address_Table where Address_1 = @add1
and Address_2 = @add2 and City =  @city.  Return back the OrgID (guid)
and no problem.

Can you guarantee that all data in sheet is already in db or will new
INSERTS be involved?

This is looking like a Stored Procedure which is why I put in the @
symbols ;->



> 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.
-----------------

Me thinks that you are not asking google the proper question.

Are you considering reading excel data into XML?
<http://www.lmgtfy.com/?q=C%23+read+excel+data+into+XML>

Now work with data in memory and update a backend data source?
<http://www.lmgtfy.com/?hl=en&q=C%23+iterate+xml+rows+update+SQL+Server>



-- 
Stephen Russell

Sr. Production Systems Programmer
CIMSgts

901.246-0159 cell

Reply via email to