Hi guys i got a problem and i dont know
here is my code...
im just trying to call a procedure and insert it in temp table,
Note: # when im i call the stored procedure without inserting it there is no problem but when i add the "insert into #TempTable22" the error will now promt.
im wondering where did i get wrong
here is the full error
"Msg 3930, Level 16, State 1, Procedure Sp_AutoJV_SalesSummary_GetChargeDetailsNoDGV2_ForTest, Line 46 [Batch Start Line 73]
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
Msg 208, Level 16, State 0, Procedure Sp_AutoJV_SalesSummary_GetChargeDetailsNoDGV2_ForTest, Line 835 [Batch Start Line 73]
Invalid object name '#Stations'.
Msg 3930, Level 16, State 1, Procedure Sp_AutoJV_SalesSummary_Report_ForTest2, Line 63 [Batch Start Line 73]
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
(0 row(s) affected)"
Begin
CREATE TABLE #TempTable22
(
ChargeType Int,
ChargeCode varchar(250),
CarrierCode varchar(250),
Market varchar(250),
CurrencyCode varchar(250),
PaymentMethodCode varchar(250),
ForiegnCurrencyCode varchar(250),
ChargeAmount Float,
ForiengAmount Float,
MarketCharge varchar(250),
DirectRate Float,
ExcessBagCommisionRate Float
)
Insert Into #TempTable22
Exec [dbo].[Sp_AutoJV_SalesSummary_ForTest] @DateFrom,@DateTo,@CurrencyCode,@OrganizationCode,@OrgCurrencyCode,@LocationCode,@Market,@Sales,@PaymentMethodCode;
End
Begin
select
ChargeType,
ChargeCode,
CarrierCode,
Market,
CurrencyCode,
PaymentMethodCode,
ForiegnCurrencyCode,
ChargeAmount,
ForiengAmount,
MarketCharge,
DirectRate,
ExcessBagCommisionRate,
0 * ExcessBagCommisionRate as Test
from
#TempTable22
End
What I have tried:
i dont have any i idea why i got that error message, since if i just call the
Exec [dbo].[Sp_AutoJV_SalesSummary_ForTest] @DateFrom,@DateTo,@CurrencyCode,@OrganizationCode,@OrgCurrencyCode,@LocationCode,@Market,@Sales,@PaymentMethodCode;
there is no error occurred and btw iam using MSSQL server