title: Incorrect syntax near 'EXEC'. Expecting CONVERSATION
body: <p>The first part of code is working perfectly but the second part doesn't work at all and shows </p>
  
  <blockquote>
    <p>Incorrect syntax near 'EXEC'.  Expecting CONVERSATION.</p>
  </blockquote>
  
  <p>I tried to use select instead for set and also tried to use conversion function but this fails </p>
  
  <hr>
  
  <pre><code>    if (@totalCash is null)
          BEGIN
            select @totalCash = 0
          END
      ELSE
          BEGIN
            set @totalCash = @totalCash
          END
      END
  
  
  
  
      declare @execute as int
      --قائمه التتدفقات النقديه 
      EXEC @execute = CashFlowInsert 'التدفقات النقديه من أنشطه التشغيل' ,' ' 
      -- التدفقات النقديه من أنشطه التشغيل
      --عجز  (فائض  ) إيرادات العام  
  
     -- &gt; first Part
      declare @TotRevnu  as int
      declare @TotExpens  as int
      declare @totalCash as int
       --select @TotRevnu  =  sum(CASE WHEN total is null then 0 else total end) AS tot1 from RevnuView
      SET @TotRevnu  =  (select sum(CASE WHEN total is null then 0 else total end) AS tot1 from RevnuView)
      set @TotExpens  = (select sum(case when total is null then 0 else total END)as tot2 from expensessview)
  
      Set @totalCash  =  @TotRevnu  - @TotExpens  
      if (@totalCash is null)
          BEGIN
            set  @totalCash = 0
          END
      ELSE
          BEGIN
            set  @totalCash = @totalCash
          END
      END
      EXEC @execute = CashFlowInsert ' عجز (فائض ) الايراد العام ' , @totalCash 
      -----------------------------------------------------------
      EXEC @execute = CashFlowInsert ' يتم تسويته بـ : ' ,' ' 
      -- المخصصات احمالى 
  
   --- &gt; Second Part 
      declare @TotAllowances as int
      set  @TotAllowances = (SELECT SUM(CASE WHEN (temp_budget.Debit - temp_budget.Credit) IS NULL THEN 0 ELSE (temp_budget.Debit - temp_budget.Credit) END) AS total
                            FROM     temp_budget INNER JOIN  asset_ss ON temp_budget.Code = asset_ss.code WHERE  (temp_budget.Code LIKE '24%'))
      if (@TotAllowances is null)
          BEGIN
               set   @TotAllowances = 0
          END
      else
          BEGIN 
               set @TotAllwances  =  @TotAllowances   
          end 
      END
  
  
      EXEC @execute = CashFlowInsert 'مخصص مكون خلال العام ' , @TotAllowances
  </code></pre>
  
  <hr>
  
  <p>CashFlowInsert    Code</p>
  
  <pre><code>CREATE procedure [dbo].[CashFlowInsert] (   
      @param1 as nvarchar(255) ,      
      @param2 as int) 
  As   
  begin     
      insert into CashFlowReport(CData,CtotalNew) values (@param1, @param2 )  
  end
  </code></pre>