Home » Other » General » Read consistency in Oracle and SQL Server
Read consistency in Oracle and SQL Server [message #472268] |
Thu, 19 August 2010 10:14  |
John Watson
Messages: 8968 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I realize that this could be classed as a question that should be asked in a SQL Server forum, if so I'm sure a moderator will say so.
I have been told that a distinguishing factor between Oracle and SQL Server is that Oracle always follows the rules for read consistency, but SQL Server doesn't. For instance, if you want to update the salary of every employee who has salary less than his department's average so that it equals the average, then Oracle has no problem with read consistency for the correlated subquery, such as:
update emp e set sal=(select avg(a.sal) from emp a where a.deptno=e.deptno)
where sal < (select avg(a.sal) from emp a where a.deptno=e.deptno);
but if you run this in SQL Server, you may get different (and inaccurate) results depending on the order of the rows and the execution plan. Can anyone confirm this? On current or past versions of SQL Server?
Regards,
The SQL Server Nemesis
|
|
|
|
Goto Forum:
Current Time: Tue Mar 11 07:49:43 CDT 2025
|