Trying to call a procedure and insert the results into a temp table:
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 INT #TempTable22
EXEC [dbo].[Sp_AutoJV_SalesSummary_ForTest] @DateFrom, @DateTo, @CurrencyCode, @OrganizationCode, @OrgCurrencyCode, @LocationCode, @Market, @Sales, @PaymentMethodCode;
SELECT
ChargeType,
ChargeCode,
CarrierCode,
Market,
CurrencyCode,
PaymentMethodCode,
ForiegnCurrencyCode,
ChargeAmount,
ForiengAmount,
MarketCharge,
DirectRate,
ExcessBagCommisionRate,
0 * ExcessBagCommisionRate as Test
FROM
#TempTable22
Note: # when I call the stored procedure without inserting it there is no problem but when I add the insert into #TempTable22
the error will now prompt.
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)