Say, if I write a web site using ASP.NET that uses the SQL Server database. My script executes something like this:
-- The meaning of the SQL doesn't matter
UPDATE t1 SET [c1]=1 WHERE [id]=3;
UPDATE t1 SET [c2]=0 WHERE [id]=4;
UPDATE t1 SET [c1]=2 WHERE [id]=7;
And while the SQL above is running another user logs in to the same page and runs the same SQL script at the same time. Does SQL Server ensure that multiple simultaneous SQL execute commands won’t get mixed together and cause a race condition?
No, not unless you wrap in a transaction: