Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 10-Jan-19 17:13pm
v2

1 solution

Based on the error message, the problem seems to be inside procedure
Sp_AutoJV_SalesSummary_GetChargeDetailsNoDGV2_ForTest
so I would start looking from there.

Te get you you started, you have 2 lines pointed out in the error message. So inside that procedure have a look at lines
- Line 46, transaction problem
- Line 835, name problem

Note that the second line (835) you have a name problem. You try to use a non-existing object '#Stations'
Invalid object name '#Stations'.

Based on that error message, could it be that the parameters affect the execution so that you haven't encountered a problem when calling the procedure separately but when calling from the other procedure the execution is different.

To get into more detail we should see the code for the procedure causing the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900