0
私はこのようにデータを挿入する際に問題に直面しています。ストアドプロシージャを使用してデータをこのように挿入する方法SQL Serverのデータ挿入、最初の行の終了残高は次の行の開始残高である必要があります
。
INSERT INTO [dbo].tbl_Transaction
(
[FK_GameID] ,
[SpotID] ,
TransactionReason ,
TransactionType ,
TransactionAmount
--PrevAmountBalance,
-- CurrentBalance
)
SELECT tblTransaction.Row.value('@FK_GameID','BIGINT'),
tblTransaction.Row.value('@SpotID','SMALLINT'),
tblTransaction.Row.value('@TransactionReason','SMALLINT'),
tblTransaction.Row.value('@TransactionType','Varchar(50)'),
tblTransaction.Row.value('@TransactionAmount','MONEY')
[email protected],
-- (@OpeningBalance-tblTransaction.Row.value('@TransactionAmount','MONEY'))
FROM @TransactionTable.nodes('/row') AS tblTransaction(Row)
そして、何の問題があります? –
私はあなたが質問を明確にする必要があると思います。 – Paaske
ありがとう、どのように最初の行の残高を次の行の残高として挿入する必要がありますか? –