I use global temporary tables for easy integration testing of my SQL Server backed application.
But the function min_active_rowversion
does not seem to include global temporary tables, like seen here:
using (var connection = new SqlConnection("data source=.;Integrated Security=True"))
{
connection.Open();
connection.Execute("create table ##mytable ( Id int, rv rowversion )");
var a = ToUInt64(connection.Query<byte[]>("select min_active_rowversion()").Single()); // => 20001
var x = ToUInt64(connection.Query<byte[]>("insert into ##mytable (Id) output Inserted.rv values (1)").Single()); // => 22647
var b = ToUInt64(connection.Query<byte[]>("select min_active_rowversion()").Single()); // => 20001
}
I can't see this limitation documented anywhere. Can this be made to work? And if so, how?