存在一個包含許多插入,更新,刪除和截斷語句的存儲過程。我想將所有的陳述逐個分組到一張表中。如何將存儲過程按行分隔到表中?
例如:
create proc Get_Tables as
begin
UPDATE BB_FMCTransactionsTwo SET wsTradeDate = wsSettleDate WHERE wsEntryCode = 'NRT'
UPDATE BB_FMCTransactionsTwo SET wsOK = 1, wsSpecialLogic = SpecialLogic FROM BB_EntryCode INNER JOIN BB_FmcTransactionsTwo ON EntryCode = wsEntryCode
UPDATE BB_FMCTransactionsTwo SET wsFMCFtNt = '' FROM BB_EntryCode INNER JOIN BB_FmcTransactionsTwo ON EntryCode = wsEntryCode WHERE wsBS <> 'B' AND (FMCFtNtB IS NULL OR FMCFtNtB = 'PR')
UPDATE BB_B204_Tran SET AMOUNT = dbo.BCA_AMT(Desc1, Desc2, Desc3, Udesc1, Udesc2, Udesc3) WHERE TRANIND = 14 AND PORTTYPE IN (2,3)
DELETE BB_B204_Tran WHERE TRANIND = 14 AND PORTTYPE IN(2,3) AND (Quantity IS NULL OR ISNUMERIC(Quantity) = 0 OR Quantity = -1 OR ISNUMERIC(AMOUNT) = 0
end
要求:
我要插入的更新語句,一個delete語句到一個表中...
創建一個存儲過程,而根據語句類型(Insert
,Update
,Truncate
)劃分存儲過程,並將其逐行插入表中。以便表格如下所示。
表:
Sl.No Statement
1 UPDATE BB_FMCTransactionsTwo SET wsTradeDate = wsSettleDate WHERE wsEntryCode = 'NRT'
2 DELETE BB_B204_Tran WHERE TRANIND = 14 AND PORTTYPE IN(2,3)
請嘗試SQL觸發,你可以記錄所有 –
u能張貼代碼上面的例子? – user2681487
雅我相信..有沒有必要訂購...只是我想插入,更新,刪除語句分別在一張表馬克.. – user2681487