Reply to Re: Working with Ints and Nulls

Your name:

Reply:


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/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация