I have a table named Car
Table car ( id int NOT NULL, plate int NOT NULL, sent_to_server bit NOT NULL );
I want to select all Cars which are not sent to server yet
SELECT *
FROM car
WHERE sent_to_server = 0;
Then I should update my DB
UPDATE car
SET sent_to_server = 1
WHERE sent_to_server = 0;
I have multiple threads so this wont work (multiple threads are reading and writing to the database at the same time -(im using sql server))
How can I execute 2 queries in One Query ? Or is there a better solution !?
note: i'm using C# with petapoco library (if it matters !)