Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

About writing the SQL Query to track Updates in the database in CDC (will appreciate an urgent reply)

$
0
0

Hi Fellows

I am working on implementing CDC ETL in my office and need to ask a question
We use to write queries to track the updates in the database like

UPDATE "Table"
SET 
B = ?
C = ?
D = ?
WHERE A = ?

In above query "Table" is the Table Name
A(PK),B,C,D are Table columns with A as Primary Key

My question is : What about the tables with structures like 1 Primary Key Column and One is Foreign Key Column (In this scenario the above table would look like)

Where "Table" is the Table Name
A(PK),B, C(FK),D are Table columns with A as Primary Key Value and C as Foreign Key

in the above version of update query, the Table is now having a primary key (as before) but also a foreign key referencing its relevant Primary Key in its Parent Table. Now do we still need to write the above query as it is to capture updates OR do we need to modify the query a bit like below ? OR in a different way?

UPDATE "Table"

SET 
B = ?
D = ?
WHERE A = ?
AND C = ?

I would appreciate If you kindly guide me in this regards

Thanks

Muhammad Imran


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>