|
Posted by Alex Kuznetsov on 12/04/06 21:17
Hurricane wrote:
> I have an instead of trigger for update on particular table which adds
> 3 or so columns and puts the total in a 4th No matter what the input is
> (as long as there is one NULL) the total is always NULL. More than
> likely is that only one of the fields has a value in it and the rest
> null but i don't want to do the MAX in case that is not true.
>
>
> a quick visual aid from input and desired output
>
> Input Data
> colA colB ColC tot
> 5 NULL NULL NULL
>
> Current Output
> colA colB ColC tot
> 5 NULL NULL NULL
>
> Desired Output
> colA colB ColC tot
> 5 NULL NULL 5
>
> How do i Manipulate the TSQL command to work correctly?
>
>
> Update tbl_lossChecks
> SET
> clc_totalFees = Inserted.mny_LegalFees + Inserted.mny_AdjusterFees +
> Inserted.mny_Expense ,
COALESCE(colA,0)+ COALESCE(colB,0)+ COALESCE(ColC ,0)
-----------------------
Alex Kuznetsov
http://sqlserver-tips.blogspot.com/
http://sqlserver-puzzles.blogspot.com/
Navigation:
[Reply to this message]
|