Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel to SQL Server

Status
Not open for further replies.

maddog1971

Programmer
Feb 21, 2002
2
JP
What I'd like to do is allow users to upload their excel spreadsheet via an asp page and then have SQL Server import that data into an existing SQL Server table. The problem that I'm running into is that I have a field within my table which is named ID and it is my primary key which is also set up as an identity field. So what happens when I try to import the data from excel I keep getting an error because of that ID field which I need because I use that within the rest of my application for viewing,editing,deleting records. At the same time that SQL Server is importing these records I'd like the capability of finding out if the record may already exist because I also have a field which isn't the primary key but shouldn't have duplicate values. If the record already exists then just update the tuple with the rest of the fields but if it doesn't exist then add the new record from the excel spreadsheet.
 
You don't have to include that ID field from excel in your upload because it's an Identity field in your sql table.

Andel
andel@barroga.net
 
Okay when I try to import the file without the ID column I keep getting an error that just says unspecified error when I try to import it with the ID field but without a value in it I get the error that states that ID cannot be inserted.
 
To maddog1971,

I need to build a very similar system to the one you have outlined and would like to know if you would be interested in providing me with your solution.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top