----------------------------------------------------------------
--                                                              
--  File:   Isolation3_S3.SQL                                   
--          Microsoft TPC-E Benchmark Kit Ver. 1.14.0-1031      
--          Copyright Microsoft, 2008-2015                  
--                                                              
--  Implements TPC-E Isolation test #3                          
--  P3 Test in Read-Write                                       
--                                                              
----------------------------------------------------------------
USE tpce
GO

BEGIN TRANSACTION

DECLARE @trade_id           bigint,
        @acct_id            bigint,
        @se_amount          numeric(10,2)

---------------------------------------------------------
--- replace the account id below with 
--- that returned in the Isolation3_S1 script.
---------------------------------------------------------
SELECT  @acct_id    = 43031663196,          ---****** CUSTOMER ACCOUNT ID FROM ISOLATION3_S1 OUTPUT
        @trade_id   = 200100353800003       ---****** TRADE ID FROM ISOLATION3_S1 OUTPUT

EXEC TradeResult_Iso3   @trade_id,
                        100,
                        @se_amount      OUTPUT

SELECT  'Customer Account Balance after Trade Result:',
        CA_BAL As 'Customer Account Balance',
        @se_amount As 'Settlement Amount',
        CONVERT(char(30), GETDATE(), 21) As 'Time Stamp'
FROM    CUSTOMER_ACCOUNT
WHERE   CA_ID   = @acct_id

COMMIT
GO
