sql - Passing temp table from one execution to another -


i want pass temp table 1 execution path 1 nested in side

what have tried this:

    declare @sqlquery nvarchar(max)      set @sqlquery = '      --populate #temptable values        execute('select top   (100)    * ' + tempdb..#temptable)       execute sp_executesql @sqlquery 

but fails error message:

incorrect syntax near 'tempdb'

is there another\better way pass temporary table between execution contexts?

your temp table visible inside dynamic sql no problem. not sure if creating temp table inside dynamic sql or before.

here table created before dynamic sql.

create table #temp(somevalue varchar(10)) insert #temp select 'made it'  exec sp_executesql n'select * #temp' 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -