the first part of code I working perfectly but the second part doesn't work at all and show error Incorrect syntax near 'EXEC'. Expecting CONVERSATION.
I tried to use select instead for set and also tried to use conversion function but this goes to fail
if (@totalCash is null)
BEGIN
select @totalCash = 0
END
ELSE
BEGIN
set @totalCash = @totalCash
END
END
declare @execute as int
------------------------------ قائمه التتدفقات النقديه EXEC @execute = CashFlowInsert 'التدفقات النقديه من أنشطه التشغيل' ,' ' -- التدفقات النقديه من أنشطه التشغيل --عجز (فائض ) إيرادات العام
-- > 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 ' يتم تسويته بـ : ' ,' '
-- المخصصات احمالى
--- > Seconde 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
Aucun commentaire:
Enregistrer un commentaire