[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Import multiple related Excel Files into SQL Server with asp.net/c#

Posted on 2013-12-04
1
Medium Priority
?
1,070 Views
Last Modified: 2014-01-03
I have 4 excel files that I would like to import into a SQL Server database using and asp.net web form. Each of the 4 excel sheets go into 4 different (but related) tables. The excel file records each have an ID field, so you can see which records are related from excel file to excel file. That ID field is not in the SQL Server tables. They have an ID field, but the values are not the same between excel and sql server. Each record will get a new SQL id once it's imported. If this was just one sheet it would not be a problem. But excel file 1 needs to be imported, then each of the other 3 files with related records (but now with a new ID that does not match the SQL id). Is there a way to import by cycling through each record from all files? So the first record in excel file 1 (the parent) is imported into SQL Server and assigned a new ID, then each related record is imported from the other 3 files into their correct tables with the new SQL ID. The on to the next record. It seems quite cumbersome to me. Can something be worked out? Any help is appreciated.
0
Comment
Question by:dodgerfan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
allanau20 earned 2000 total points
ID: 39697426
say you imported the 4 excel files into their tables. In each table you should have the common ID field that the 4 tables can share just like you would in the 4 excel files? You can use that ID as the key to join (build relations) to the other tables. You don't have to match on the ID that SQL generated. What issues do you have with using the ID field from excel?
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question