title: incorrect syntax near keyword select expecting as
body: <p>i have following procedure</p>
  
  <pre><code>Create procedure Getdatewiseprofitrecord
  @Date date
  As
  Begin
  select *into #temptable from(select prof.Productid, SUM(prof.Amount)Amount,SUM(prof.QuantitySold)Quantitysold,SUM(prof.ProfitAmount) from ProfitRecord prof
  where prof.Date=@Date
  group by Productid)
  
  
  select temp.*,pro.ProductName from #temptable temp
  inner join Productinfo pro on temp.Productid=pro.ProductId
  
  drop table #temptable
  
  
  End
  </code></pre>
  
  <p>but i get <code>incorrect syntax near keyword expecting as,id or...</code></p>
  
  <p>I could not figure the issue.</p>