说我有一个像这样的临时表:
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
,请将其作为#temptable
存储在103.85
中,反之亦然。
任何人都可以建议一种更改我的插入语句的方法来控制临时表中Balance
字段的信用/借记格式。
答案 0 :(得分:0)
Insert into #temptable
exec getstatementhistory @cust_ref
--After the Insert, update the contents to reverse the format
Update #temptable
set Balance = Balance*-1