tsql 为什么不能不能将表变量直接进行付值,复制引用
declare @table1 as table
declare @table2 as table
不能直接进行付值吗?@table1=@table2
临时表直接能这样付值吗?复制引用?
--try
declare @t1 table(ID int)
insert @t1 select 1
insert @t1 select 2
insert @t1 select 3
select * from @t1
declare @t2 table(ID int)
insert @t2 select * from @t1
select * from @t2
declare @table1 as table --不能这么使用的
declare @table2 as table --正确使用:declare @table1 table(id int ,name varchar(10))
不能直接进行付值吗?@table1=@table2 --应该使用 insert into @table2 select * from @table1