DECLARE @cltcode VARCHAR(30) DECLARE @brand VARCHAR(30) select @cltcode=cltcode,@brand=brand from prosamplehd CREATE table #t ( cltcode VARCHAR(30), brand VARCHAR(30) ) INSERT into #t (cltcode ,brand) VALUES (@cltcode ,@brand) select *from #t
解释:
DECLARE 定义变量后
创建临时表,然后insert into 中插入变量的返回值,