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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Compare two tables in ssis
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

aswindba1
Yak Posting Veteran

USA
62 Posts

Posted - 12/05/2012 :  13:25:13  Show Profile  Reply with Quote
I want to insert values in to “Table B” from “Table A”. Both the tables has only two columns and same.

Table B is destination table and it's constant. Table A is getting Updated every week.
So I have to extraxt the data from table A and compare with table B and updated.



If the data is not exists in “Table B” I want to insert values from “Table A”
If the data is exists in both tables do not do anything. (Like eliminating the duplicates).
Insert only updated data from Table A in to table B


I want to implement this by SSIS. Which component can i use in SSIS , and how ?

Tell me in step by step, I am very new in SSIS

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/05/2012 :  15:18:14  Show Profile  Reply with Quote
Create a stored procedure to do the merging. The stored procedure would contain code like this:
INSERT INTO TableB
(col1, col2)
SELECT
	col1,col2
FROM
	TableA a
WHERE NOT EXISTS
(
	SELECT * FROM TableB b
	WHERE b.col1 = a.col1 AND b.col2 = a.col2
);


Then, create an Execute SQL Task in SSIS and have it call that stored procedure.
Go to Top of Page

aswindba1
Yak Posting Veteran

USA
62 Posts

Posted - 12/05/2012 :  16:03:38  Show Profile  Reply with Quote
Awesome..its working fyn
Thank you very much..I appreciate your help
Go to Top of Page

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 12/05/2012 :  17:39:50  Show Profile  Reply with Quote
If your requirement is complex .check this out
http://www.sqlis.com/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 12/06/2012 :  01:59:30  Show Profile  Reply with Quote
there are lots of methods

1. T-sql using LEFT JOIN,NOT EXISTS,NOT IN
2. t-sql MERGE statement
3. SSIS using Lookup
4. SSIS using Merge Join etc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000