Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 updating field in DB with value in Excel

Author  Topic 

PGG_CA
Starting Member

24 Posts

Posted - 2013-06-18 : 16:18:12
Hi,

How would I do this in SSIS?
- I have an Excel file that has columns: A and B
- DB table has these columns too.
- The SSIS task is to update column B in the DB table with the value supplied by column B that matches column A in the spreadsheet.

A B
123 abc

If 123 exists in the table then for that record, update column B with abc.

Thanks.

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2013-06-18 : 16:22:28
Load the excel file in ssis into a "staging" table - just some other table with the same layout.
Next task in the SSIS package must be a sql task which will be a Merge statement or a update statement setting column B to the value of B from the staging table where there is a match on the values of column A of both tables.

Not too difficult really.

Duane.
http://ditchiecubeblog.wordpress.com/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-19 : 01:11:25
if you dont want to use SSIS you could simply do it in T-SQL using OPENROWSET

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -