title: Insert Data Into temporary table using Select * Into
body: <p>I want to insert data into temporary table for that i am using <code>select * into</code> syntax.</p>
  
  <p>But i am getting error :</p>
  
  <pre><code>Msg 102, Level 15, State 1, Line 8
  Incorrect syntax near ')'.
  </code></pre>
  
  <p>Though Single Query getting executed successful.</p>
  
  <p>Code:</p>
  
  <pre><code>Create Table #_Total
  (
  A   Int,
  B   Int,
  C   Int,
  D   Int
  )
  
  Select * InTo #_Total From(
  Select 
  Sum(Case When Closed=0 And ISNULL(VendorTicketNo,'')='' Then 1 Else 0 End),
  Sum(Case When Closed=1 And TicketType&lt;&gt;8 AND ISNULL(VendorTicketNo,'')&lt;&gt;'' Then 1 Else 0 End),
  Sum(Case When Closed=1 And CAST(ClosedOn As DATE)= CONVERT(VARCHAR(8),GETDATE(),112) Then 1 Else 0 End),
  Sum(Case When Closed=0 And TicketType=8 Then 1 Else 0 End)
  From ALBATMStatus.dbo.Ticket
  )
  
  Select * From #_Total
  </code></pre>
  
  <p>Database - SQL SERVER 2008</p>