• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 364
  • Last Modified:

Multithreaded App with MSSQL

Hi,

I've got a multitheaded application using MSSQL.
This question has been simplified to avoid confusion.

If I program 10 threads to do the following 10,000 times:-

UPDATE tblTest SET fCounter=fCounter+1

..can I be sure that fCounter will always equal 100,000 at the end even though its getting the command hundreds of times per second?

Is there a setting I need to change that will force SQL server to keep track of things properly?
Thanks
Dan
0
DanJourno
Asked:
DanJourno
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
It should do because SQL will lock the row for each update. Therefore SQL should allow more than one connection to perform the update at once.
0
 
manlimnagCommented:
if you want to doubly sure use the hints in query how to apply locks
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now