------------------------------------------------------------------
--                                                              --
--  File:   Isolation3_S3.SQL                                   --
--          Microsoft TPC-E Benchmark Kit Ver. 1.12.0-1025      --
--          Copyright Microsoft  2010, 2011, 2012               --
--                                                              --
--  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    = 43001319693,          ---****** CUSTOMER ACCOUNT ID FROM ISOLATION3_S1 OUTPUT
        @trade_id   = 200042102920002       ---****** 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
