title: Create a temporary table from a subquery in sql server causing error
body: <p>I have something like this</p>
  
  <pre><code> if object_id('tempdb.#TempHourlyTable') is not null
  drop table #TempHourlyTable
  
   select * into #TempHourlyTable
   from (
           select top 10 * from customers
        )
  </code></pre>
  
  <p>I get an error like this: </p>
  
  <blockquote>
    <p>Incorrect syntax near ')'.</p>
  </blockquote>
  
  <p>My first attempt with temporary tables. So what is the mistake here? </p>
  
  <p>EDIT:<br>
  Drop and recreate if temporary table exists. Getting error </p>
  
  <blockquote>
    <p>Msg 2714, Level 16, State 6, Line 55<br>
        There is already an object named '#TempHourlyTable' in the database.</p>
  </blockquote>