November 8, 2012 at 9:32 am
hi,
i dont know which component do i need to use for my req.
i have 2 column from my table ,productid and productname
now when file comes, i need to see if productid is match, if yes then if product name is empty then insert productname into productname column in table.
now if both r match just ignore.
what should i use ,i tried lookup but doesnt work
November 8, 2012 at 11:26 am
With the limited information you have given, I suggest that you use BOL (Books On Line) the SQL help file and look at the item titled "Merge"
or use GOOGLE and search for "sql server merge" ...
if this does not help please post table definition(s), some sample data (click on the first link in my signature block for an article that contains the T-SQL that will allow you to post the table definition and some sample data quickly and easily) ...and someone will attempt to help you ...
November 9, 2012 at 6:41 pm
I am confident the Lookup Transform can be used to arrive at a solution but here are a couple more options:
1. Load the incoming file into a staging table and then write an update statement that joins the staging table and the destination table to update all necessary rows followed by aninsert statement to insert new rows.
2. Call a stored proc for each incoming row that implements the logic to either insert a new row, update and existing row, or ignore the incoming data.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply