I'll give an example of what I'm doing, but the very question is at the end.
I have a table with 4,100,000 records and I am creating a theft that reads this data and exports it to MYSQL (it does not enter into the agenda, just to set it up).
I have two columns BIT
, one is called processing and the other is migrated, in an infinite loop I execute this command
SELECT TOP 100 Title,Tamanho,Caption,dataHoraIndexacao,Date,Resolucao,Base,Altura,orientacao,codigo,NomeArquivo FROM migracao.Reuters WHERE processing = 0 and migrated = 0
I want to run several thefts at the same time to speed up the process, the point is, when I do SELECT
right after the population of my List in C #, I give an update on all items as processing = 1
and this takes a while, imagine that while I give UPDATE
another theft of a SELECT
and returns the same data that I'm giving UPDATE
, that is, duplicate information.
The question is : How do I lock a table while giving UPDATE
to it?