title: How do I get SSMS intellisense to keep my temp tables when I change DBs?
body: <p>When I select into a temp table, after changing databases intellisense no longer recognizes my temp table.</p>
  
  <p><img src="https://i.stack.imgur.com/ErUAp.png" alt="enter image description here"></p>
  
  <p>The interesting thing is if I create the table via a <code>create table</code> query the temp tables will follow me.</p>
  
  <p>Am I doing something wrong to cause this to happen or is this a limitation of SQL Server Management Studio?</p>
  
  <p>This happens with both Management Studio 2008 and 2012 and with SQL databases 2008, 2008 R2, and 2012.</p>
  
  <hr>
  
  <p>Here is a easy to copy version of the source to test yourself, you must be connected to a sql server that supports intelisense (2008 and up)</p>
  
  <pre><code>use [master]
  select * into #foo from sys.tables
  create table #bar (baz int)
  
  select name from #foo
  select baz from #bar
  
  use [tempdb]
  select name from #foo
  select baz from #bar
  </code></pre>