if object_id('tempdb.dbo.#test') is not null drop table #test
create table #test (testid int )
insert into #test
select '1' union all
select '2' union all
select '3' union all---->
select testid
from #test
order by testid desc
例如这段代码,我在执行的时候,只能实行插入表,然而没有执行select~查询一次后,把create下面的插入代码删除,它就能执行select了~~why??那么如何实现一次插入,马上select呢?而且不懂why?exec('')中放入那段select代码是报错的。
create table #test (testid int )
insert into #test
select '1' union all
select '2' union all
select '3' --union all---->
select testid
from #test
order by testid desc
create table #test (testid int )
insert into #test
select '1' union all
select '2' union all
select '3'
---->
select testid
from #test
order by testid desc