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 2008 Forums
 Transact-SQL (2008)
 Subtraction not working

Author  Topic 

macca
Posting Yak Master

146 Posts

Posted - 2011-12-09 : 08:42:34
I am subtracting the values of 2 fields:

SELECT(a.Days_Since - a.Total_Days) as Days_Since FROM tblCall a

The Field Total_Days is either NULL or contains a number. If Total_Days contains a number it will work fine and return a value but if Total_Days is NULL it will return no value even if Days_Since contains a value.

Anyone know what I'm missing?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-12-09 : 08:44:48
isnull(column,0)



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

macca
Posting Yak Master

146 Posts

Posted - 2011-12-09 : 08:48:27
Thanks that worked Webfred
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-12-09 : 08:50:02
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -