How to find all newly added row in table ?
Hello friends
I am working on SSIS package.I need to find only those record which added in my table.
This is my query and few result :-selecting record from a table ,fetching max and min key using sub-query and comparing with another key; here i only want ;
1. If User added some record in FCP table added only those record would be reflect in my query
2. I want only those record which have latest value for the particular id
Select fcp.servicepointid ,fcp.channelnumber ,r.EndTime ,round(r.datavalue,4) datavalue
from reading r,FlatConfigPhysical_Test fcp
where r.nodeid = fcp.spcnodeid
and r.readinggroupalternatekey >(select min(ReadingGroupAlternateKey) from dbo.reading)
and r.readinggroupalternatekey < (select max(ReadingGroupAlternateKey) from dbo.reading)
AND fcp.unitofmeasureId IN ('KWH','KVARH')
and fcp.mtrchnltype = 'I'
order by fcp.servicepointid,fcp.channelnumber,r.EndTime;
servicepointid channelnumber EndTime datavalue
1032962 1 2010-03-19 14:00:00 15.396
1032962 1 2010-03-19 15:00:00 15.594
1032962 1 2010-03-19 16:00:00 8.64
1032962 1 2010-03-19 17:00:00 8.892
1032962 1 2010-03-19 18:00:00 9.138
1032962 1 2010-03-19 19:00:00 9.276
1042540 1 2010-03-24 04:00:00 1.856
1042540 1 2010-03-24 05:00:00 0.856
1042540 1 2010-03-24 06:00:00 0.88
1042540 1 2010-03-24 07:00:00 0.864
1042540 1 2010-03-24 08:00:00 0.824Abhishek Parihar BI Consultant
January 17th, 2011 1:46am
you can use lookup transformation for the same. please check the
similar thread
Let us TRY this |
My Blog :: http://quest4gen.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
January 17th, 2011 1:50am
I highly recommend integrating the techniques referenced in the "similar thread" link that ETL vs ELTL provided. Adding a Checksum column to Type 1 and Type 2 tables has become a standard for our Data Warehouse. I cannot tell you how much simpler our ETL
has become since we've started using the Checksum with SSIS. Because you want to retain history, I suggest browsing the web for "SSIS Type 2 Dimension". You may also find adding an Active flag to your table helpful. This way you can easily identify the current
record.
Good luck.Brian
January 17th, 2011 4:37pm