?
Solved

Why are my SQL Server results NULL?

Posted on 2014-02-18
2
Medium Priority
?
262 Views
Last Modified: 2014-05-19
I built a view that simply sums up columns for each record. Why are my results NULL? My query is below and all my columns are set to Data Type: Decimal. I have also tried setting the data type to numeric with the same results.

SELECT        QUOTETRK, OTHERFEE2 + OTHERFEE1 + AOGTRANFEE + PACKFEE + QOTAMT AS QOTTOTAL
FROM            dbo.AS400DATA

Open in new window

0
Comment
Question by:maximus1974
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
lludden earned 2000 total points
ID: 39867627
If any of the values are null, the result is null.  If you don't want that, then you can wrap each value in an ISNULL(<field>,0)

SELECT        QUOTETRK, ISNULL(OTHERFEE2,0) + ISNULL(OTHERFEE1,0) + ISNULL(AOGTRANFEE,0) + ISNULL(PACKFEE,0) + ISNULL(QOTAMT,0) AS QOTTOTAL
FROM            dbo.AS400DATA

Open in new window

0
 

Author Closing Comment

by:maximus1974
ID: 39868286
Excellent. Should have thought of that. Thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question