Link to home
Start Free TrialLog in
Avatar of socom1985
socom1985

asked on

import missing field from excel into a mssql 2008R2 database

Hi guys. I’m struggeling with an import from an excel file into an existing mssql 2008R2 database table. We’re missing a field in this specific table. The excel file contains a column with  the value of this missing field and one with a key.

ID:  Missing field:
01      test1
02      test2
03      test3
….
 
My question how can I update the missing field from my excel file for each row?
Avatar of Makrini
Makrini
Flag of Australia image

How are you trying to update the table.

1. Does the table have a column for the missing field?
2. Does the table have an "ID" which corresponds with the Excel file "ID"?
3. Are you using Excel to put into SQL, or SQL to pull from Excel
4. What version of Excel
5. Are you using SSIS or openrowset, or what method?
Avatar of Howard Cantrell
It depends how you are reading the excel file.
Need more info to answer this.
ASKER CERTIFIED SOLUTION
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A simpler aproach than SSIS is to attach the excel by using a linked server.

Regards Marten
In addition to martenrune: which can be created on the fly using the OPENROWSET function :)

But it's not always straightforward as the following article will point out: https://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/A_3025-Retrieving-Data-From-Excel-Using-OPENROWSET.html