title: is it posible, create a temp #table inside a openrowset?
body: <p>i am trying execute this query but i got a error:</p>
  
  <pre><code>Msg 8180, Level 16, State 1, Line 1
  Statement(s) could not be prepared.
  Msg 208, Level 16, State 1, Line 11
  Invalid object name '#test1'.
  </code></pre>
  
  <p>my code:</p>
  
  <pre><code>select * from openrowset ('SQLOLEDB','DRIVER={SQL Server};SERVER=10.12.131.58;UID=sa;PWD=desarrollo','
  
  
  
  create table #test1
  (
  id int,
  name1 varchar(50)
  )
  
  insert into #test1
  select cliente,nomcli from opepte.dbo.clientes
  
  select * from #test1
  
  /*this is a example but in real query i need manipulate this information and return 
  a resulset with few rows
  */
  
  
  ')
  </code></pre>
  
  <p>but this other query works fine.</p>
  
  <pre><code>select * from openrowset ('SQLOLEDB','DRIVER={SQL Server};SERVER=10.12.131.58;UID=sa;PWD=desarrollo','
  
  
  
  create table #test1
  (
  id int,
  name1 varchar(50)
  )
  
  --insert into #test1
  select cliente,nomcli from opepte.dbo.clientes
  
  --select * from #test1
  
  /*this is a example but in real query i need manipulate this information and return 
  a resulset with few rows
  */
  
  
  ')
  </code></pre>
  
  <p>Note: insert into #test1 and select * from #test1 are coment </p>