А
Size: a a a
А
А
ДС
ДС
begin transaction
go
create procedure t1
as
begin
create table #tab (i int)
insert into #tab values (1)
select i as proc_t1 from #tab
end
go
create procedure t2
as
begin
create table #tab (i int)
insert into #tab values (2)
select i proc_t2 from #tab
end
go
create table #tab (i int)
insert into #tab values (0)
select i as i0 from #tab
go
exec t1
select i as i1 from #tab
exec t2
select i as i3 from #tab
rollback transaction
go
MC
G
begin transaction
go
create procedure t1
as
begin
create table #tab (i int)
insert into #tab values (1)
select i as proc_t1 from #tab
end
go
create procedure t2
as
begin
create table #tab (i int)
insert into #tab values (2)
select i proc_t2 from #tab
end
go
create table #tab (i int)
insert into #tab values (0)
select i as i0 from #tab
go
exec t1
select i as i1 from #tab
exec t2
select i as i3 from #tab
rollback transaction
go
ДС
ДС
ДС
ДС
G
However, if a query references a temporary table and two temporary tables with the same name exist at that time, it is not defined which table the query is resolved against.