我正在使用 Teradat 14 .NET 提供程序。我想在单个事务中执行以下 SQL:
delete mydb.mytable;
insert into mydb.mytable select * from mydb.myothertable;
我遇到的这个问题是,虽然删除是即时的,但插入需要几秒钟。如果在删除之后但在插入提交之前(而不是在执行插入之前)发生选择,则不会返回任何行。SELECT
因此,在提交事务之前 ,我不希望任何其他语句都可以看到这两个语句的结果。IsolationLevel.Snapshot
有一个最符合我想要的描述:
Reduces blocking by storing a version of data that one application can read while another is modifying the same data. Indicates that from one transaction you cannot see changes made in other transactions, even if you requery.
问题是 Teradata 14 似乎不支持这种类型的事务:
The isolation level is not supported by this version of Teradata Database.
我必须做些什么来保持和的结果delete
不insert
被其他人看到select
在提交事务之前,
编辑
这是我在 dnoeth 回答后使用的代码。我正在使用 Teradata 会话并将所有 SQL 放入单个字符串中,如果在删除之后但在插入完成之前完成选择,则该字符串仍然不返回任何结果。dnoeth,我是按照你的建议做的吗?TdTransaction
请注意,因为我bt;et;
在 SQL 中做,所以没有对象。
Using con As TdConnection = GetNewConnection()
Using cmd As TdCommand = con.CreateCommand
cmd.CommandText = "bt;delete mydb.mytable;insert into mydb.mytable select * from mydb.myview;et;"
cmd.ExecuteNonQuery()
End Using
End Using