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
 General SQL Server Forums
 New to SQL Server Programming
 How to distinguish new rows? Please help Urgent

Author  Topic 

evrimagha
Starting Member

5 Posts

Posted - 2009-07-15 : 17:56:17
Hi

I am working on a database (A) that gets replicated from another database (B) every night to get new data.

I have another database (C) that uses a different structure, but the same data as A.

My question is, every night after replication on A is done, how can I run a query to get me only those updated rows from each table?

Many many thanks
Evrim

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-07-16 : 02:00:18
Include a Datetime column in each table of Database A , then run a query and update in C Db

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

erichan
Starting Member

3 Posts

Posted - 2009-07-16 : 10:39:43
I would suggest a new table to record the ID range (min and max) of each replicated table every day if those tables have a unique and incremental ID column. Alternatively, a datetime column is a possible solution, but only date (rather than time) of replication is saved.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-16 : 12:29:12
quote:
Originally posted by evrimagha

Hi

I am working on a database (A) that gets replicated from another database (B) every night to get new data.

I have another database (C) that uses a different structure, but the same data as A.

My question is, every night after replication on A is done, how can I run a query to get me only those updated rows from each table?

Many many thanks
Evrim


i think an audit column like datemodified is enough for this. you can simply look for records having this column's value greater than current day.
Go to Top of Page
   

- Advertisement -