Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 isnull question

Author  Topic 

Saeed
Starting Member

39 Posts

Posted - 2002-09-16 : 19:30:34
Can some one try to help me understand this

Update MYTABLE with (ROWLOCK)
Set AdjustValue = isnull(AdjustValue,0) - @AICCost
WHERE MCCN = @MCCN


Does isnull() mean if AdjustValue is null , replace it with a zero ? correct?

if so
then AdjustValue =0-@AICCost .No?
so why have that lengthy expression instead of

AdjustValue =-@AICCost

I m sure i m misuderstanding something here with isnull


robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-09-16 : 19:56:29
Because AdjustValue = 0-@AICCost is NOT true if Adjust value is NOT null. If you want to subtract @AICCost from AdjustValue, and want it to process Nulls, all in the same query, then what you have is correct.

Go to Top of Page
   

- Advertisement -