Solved

Checking 2 columns in 2 tables row by row using ssis

Posted on 2008-06-11
1
217 Views
Last Modified: 2011-10-19
hi,
i have 2 tables   A and B. i attached a file below.
i have a task to check each value of column A with each value of column B.
iF if value 30 exist in A and Not present in B.
we should get  a result set "30 deleted from A". and if New values found in B it should be entered into other resultset.
I am trying to work it out through SQL server 2005 or SSIS
i am not able to find a way.
please help
New-Text-Document.txt
0
Comment
Question by:kgadde
1 Comment
 
LVL 2

Accepted Solution

by:
howyue earned 250 total points
ID: 21766033
ur question sounds to me like a synchronization between 2 tables. there are many ways of doing this, based on ur situation, for example using TableDiff provided by sql 2005, using 3rd party program, using storedprocedure or query. i did once before using storedprocedure synchronizing 2 database in different region using linked server, which suited my circumstance.

to give u a rough idea how to do it in query, check out my sample code.
/* Get whatever value exist in table A but not table B */

INSERT INTO B

SELECT A.Value 

FROM A

LEFT JOIN B 

	ON A.Value = B.Value /* u need to specify all the columns to compare here */

WHERE B.Value IS NULL

/* Get whatever value exist in table B but not table A */

INSERT INTO A

SELECT B.Value 

FROM B

LEFT JOIN A

	ON A.Value = B.Value /* u need to specify all the columns to compare here */

WHERE A.Value IS NULL

Open in new window

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now