本文介绍了阅读这两个潜在的和未提交的事务数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用从.NET的SQL Server,它是可能的(使用相同或不同的连接)来阅读这两个基础数据还有的尚未提交的从另一个单独的连接的变化?

Using SQL Server from .NET, is it possible (using the same or separate connections) to read both the underlying data as well as the as-yet uncommitted changes from another separate connection?

例如:

我有连接1,这将启动一个事务,并插入与标识== 1的记录到一个表,但不承诺它

I have Connection1, which starts a transaction and inserts a record with Id == 1 into a table but doesn't commit it

从连接2,我想读表不存在该行

From Connection2, I would like to read the table without that row existing

从连接2或连接3,我想读表与行现有的。

From Connection2 or Connection3, I would like to read the table with the row existing.

推荐答案

是的,你需要启用脏读又称读取未提交

Yes, you need to enable dirty reads aka READ UNCOMMITTED

编辑:

要读这两组数据,你会在一个连接中需要的快照隔离的组合,而在另一个读取未提交。

To read both sets of data you'd need a combination of "snapshot isolation" in one connection and "read uncommitted" in another.

情况因人而异。这是不是...

YMMV. It isn't something...

  1. 在我试过
  2. 见一个用
  3. 在我有信心

这篇关于阅读这两个潜在的和未提交的事务数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 01:04