How to do bulk upload and delete
There are two tables
Code:
TX
------------------------------
HIT_ID USERID AUTHENTICATED
Code:
USERACCESS
--------------------------------
HIT_ID USERID
I Want to update all the rows from USERACCESS to
TX such that USERID is updated in TX table where
TX.HIT_ID equals USERACCESS.HIT_ID
I have used following query:
Code:
update
TX
set
USERNAME = (select USERID from USERACCESS where
USERACCESS.HIT_ID = TX.HIT_ID FETCH FIRST 1 ROW ONLY) ,
ISAUTHENTICATED = 'Y'
WHERE
HIT_ID IN (
select WEBHIT_ID FROM USERACCESS.HIT_ID
)
There crores of records in TX table and lacks of records in USERACCESS TABLE. Please suggest the update query I am running is ok or not. It is taking long time to update.
I have to delete the HIT_ID from USERACCESS table that are updated to TX table. Please suggest how can I achieve this tasks.
For now I have written a trigger that that does delete on Update of TX table.
Any help appreciated.