Msg 232, Level 16, State 3, Line 5 Arithmetic overflow error for type int
<p>how can i find the difference between two variables? </p>

<pre><code>error is Msg 232, Level 16, State 3, Line 5
Arithmetic overflow error for type int, value = -39827814763.955299.

Msg 232, Level 16, State 3, Line 12
Arithmetic overflow error for type int, value = -39827814763.950142.
</code></pre>

<p>query is below..
TIA</p>

<pre><code>declare  @sql int 
declare @sql1 int
declare @sql3 int

set @sql = (select sum(sfg.amount) as VM_Amount_LCY
  from Setup_Company sc inner join stg_dim_dimension02 sdd on 
sdd.company_id = sc.company_id inner  join stg_fact_dimension_set_entry fdse on fdse.dim02_sk = sdd.dimension_id and fdse.company_id=sdd.company_id
inner join stg_fact_gl sfg on sfg.[dimension set id] = fdse.[Dimension Set ID] and sfg.company_id= fdse.company_id )



set @sql1 = (select sum(sfg.amount) as BI_Amount_LCY from [NORRIQ Drink-IT BI 2013 India].dbo.Setup_Company sc inner join [NORRIQ Drink-IT BI 2013 India].dbo.dim_dimension02 sdd on 
sdd.company_id = sc.company_id inner  join [NORRIQ Drink-IT BI 2013 India].dbo.fact_dimension_set_entry fdse on fdse.dim02_sk = sdd.dimension_id and fdse.company_id=sdd.company_id
inner join [NORRIQ Drink-IT BI 2013 India].dbo.fact_gl sfg on sfg.[dimension set id] = fdse.[Dimension Set ID] 
and sfg.company_id= fdse.company_id )


select @sql3 = (-(@sql) - (-(@sql1)))
</code></pre>