这么简单的SQL也出错了
exec('select * into [#aa] from (' + 'select ''aa'' as colA, ''b'' as colB ' + ') tes')
select * from [#aa]
提示对象名 '#aa' 无效。
如果把#都去掉则可以执行,是什么原因啊,如果一定要加上#改怎么办
------解决方案--------------------exec( 'select * into [#aa] from ( ' + 'select ' 'aa ' ' as colA, ' 'b ' ' as colB ' + ') tes ')
select * from [#aa]
动态SQL,不能使用临时表,换为aa