2013-08-30 75 views
0

說我有一個臨時表所示:信用卡/借記格式

create table #temptable 
    (
     RecordId int, 
     Balance money NOT NULL, 
    ) 

我現在填充與只傳遞一個客戶從存儲過程中獲取的數據臨時表參考。

Insert into #temptable 
exec getstatementhistory @cust_ref 

我現在想要做一些更新/插入到一個不同的表,使用已存儲在#temptable的信息。我有一個問題,雖然,我希望所有的借記存儲在#temptable像這樣103.85和所有的學分將被存儲在#temptable這樣-103.85

我的問題,是存儲過程執行相反的約定,以便借方的格式爲這-103.85和這樣的積分103.85

我需要的是在INSERT INTO #temptable指定扭轉平衡約定。

如果從SP傳遞-103.85,將其存儲在作爲#temptable103.85,反之亦然。

任何人都可以提出一種改變我的插入語句來控制我的臨時表中Balance字段的信用/借記格式的方法。

+0

你可以粘貼你當前的'INSERT'語句嗎?基本上你必須否定插入到'balance'中的值。 –

回答

0
Insert into #temptable 
exec getstatementhistory @cust_ref 

--After the Insert, update the contents to reverse the format 

Update #temptable 
set Balance = Balance*-1 
相關問題