日期:2014-05-17  浏览次数:20439 次

存储过程中不能直接查询数据给临时表吗?
在SQL中语句 select into #aa from test 不用声明表#aa ,在存储过程中提示未定义,我声明了,好像还要声明所有表的字段,感觉好麻烦,不知道是我不会还是真的要先创建表的字段?

------解决方案--------------------
insert #tt
select *
from test
可以运行!
楼主的那种select * into #tt exec(select * from test)
形式无法运行。
------解决方案--------------------
exec('select * into #a from test')这个是可以运行的!