declare @i int = 1
if (@i= 2)
Begin
declare @t table (value int)
insert into @t
select 1
select * from @t
end
else
select *from @t
---------------
declare @i int = 1
if (@i= 2)
Begin
create table #t(value int)
insert into #t
select 1
end
else
select *from #t
为什么表变量在此代码中不会得到无效的对象名称错误提示?
SELECT * FROM tempdb.sys.columns WHERE name = 'foobar';DECLARE @T TABLE(foobar int);
- Martin Smith