on 07-08-2014 1:38 PM
Hi Experts,
We are facing problem in one JDBC to proxy scenario in which we are trying to fetch records from source DB using 'select TOP 500' and in update we have update top(500) for same condition but from 9500 records only 2300 are coming to target.We also checked that all the records are unique.
select TOP 500 F6Accounts.dbo.TOLRecord.EmpCode,F6Accounts.dbo.TOLRecord.ConcID, F6Accounts.dbo.TOLRecord.eDate, F6Accounts.dbo.TOLRecord.eTime, F6Accounts.dbo.TOLRecord.Extra6,F6Accounts.dbo.TOLRecord.Status from F6Accounts.dbo.TOLRecord WHERE F6Accounts.dbo.TOLRecord.eDate ='2014-06-08 00:00:00:000' AND F6Accounts.dbo.TOLRecord.Extra6 is NULL
update top(500) F6Accounts.dbo.TOLRecord set F6Accounts.dbo.TOLRecord.Extra6 = 'X' WHERE F6Accounts.dbo.TOLRecord.eDate ='2014-06-05 00:00:00:000' AND F6Accounts.dbo.TOLRecord.Extra6 is NULL
what is wrong in this? please help.
Here extra6 field act as flag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Closing the thread...This issue got resolved.
Had to put more conditions in update query.
Bacially I put same select query in update also as a condition.
select TOP 500 F6Accounts.dbo.TOLRecord.EmpCode,F6Accounts.dbo.TOLRecord.ConcID, F6Accounts.dbo.TOLRecord.eDate, F6Accounts.dbo.TOLRecord.eTime, F6Accounts.dbo.TOLRecord.Extra6,F6Accounts.dbo.TOLRecord.Status from F6Accounts.dbo.TOLRecord WHERE F6Accounts.dbo.TOLRecord.Extra6 is NULL ORDER BY F6Accounts.dbo.TOLRecord.EmpCode,F6Accounts.dbo.TOLRecord.eTime
UPDATE F6Accounts.dbo.TOLRecord SET F6Accounts.dbo.TOLRecord.Extra6 = 'X' WHERE F6Accounts.dbo.TOLRecord.EmpCode in ( select TOP 500 F6Accounts.dbo.TOLRecord.EmpCode from F6Accounts.dbo.TOLRecord WHERE F6Accounts.dbo.TOLRecord.Extra6 is NULL ORDER BY F6Accounts.dbo.TOLRecord.EmpCode,F6Accounts.dbo.TOLRecord.eTime) AND F6Accounts.dbo.TOLRecord.eTime in (select TOP 500 F6Accounts.dbo.TOLRecord.eTime from F6Accounts.dbo.TOLRecord WHERE F6Accounts.dbo.TOLRecord.Extra6 is NULL ORDER BY F6Accounts.dbo.TOLRecord.EmpCode,F6Accounts.dbo.TOLRecord.eTime)
Thanks for all your helps experts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
The values that you gave for eDate in the select/update query are just an example or same values are used in the query? Because i see dates are different in Select and Update query.
'2014-06-08 00:00:00:000'
'2014-06-05 00:00:00:000'
Regards
Osman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.