------------------------------------------------------------------
--                                                              --
--  File:   Isolation4_S3.SQL                                   --
--          Microsoft TPC-E Benchmark Kit Ver. 1.12.0-1025      --
--          Copyright Microsoft  2010, 2011, 2012               --
--                                                              --
--  Implements TPC-E Isolation test #3                          --
--  P1 Test in Read-Write                                       --
--                                                              --
------------------------------------------------------------------
USE tpce
GO

BEGIN TRANSACTION 

DECLARE @acct_id        bigint,
        @cust_id        bigint,
        @ca_bal         numeric(12,2)

---------------------------------------------------------
--- replace the customer id below with 
--- that was used in the Isolation4_S1 script.
---------------------------------------------------------
SELECT  @cust_id        = 4300640660,       ---****** CUSTOMER ID FROM ISOLATION4_S1 OUTPUT
        @acct_id        = 43006406594       ---****** CUSTOMER ACCOUNT ID FROM ISOLATION4_S1 OUTPUT

--- execute Customer Posistion_Iso4
EXEC CustomerPosition_Iso4    @cust_id, ' ', @acct_id

--- get the CA_BAL for the customer account we used
SELECT  @ca_bal = CA_BAL
FROM    CUSTOMER_ACCOUNT
WHERE   CA_ID = @acct_id

PRINT   ' '
PRINT   'Values used in/returned from Isolation 4 - S3:'
SELECT  @acct_id    As 'Customer Account ID',
        @ca_bal     As 'Customer Account Balance'

COMMIT
GO
