Showing posts with label SUM in SQL Server. Show all posts
Showing posts with label SUM in SQL Server. Show all posts

Monday, March 3, 2014

How to sum with null valued columns in SQL Server


How to SUM NULL valued column in SQL Server :

Here i want to sum columns which contains null values also.
for this we use ISNULL method in SQL Server.
ISNULL required to parameters one is column name,second is value.

Syntax : ISNULL(column,0) .
here i check if column is 'null' then replace it with '0',you can replace null value with any other integer value (you can use string values when you concatenation  tow strings)

Ex:
SELECT SUM(ISNULL(clm1,0)+ISNULL(clm2,0)+ISNULL(clm3,0)) from table1.

amazon

Sukanya Samriddhi Account - SBI

SUKANYA SAMRIDDHI Account information by SBI SUKANYA SAMRIDDHI ACCOUNT : FACILITY AVAILABLE AT ALL BRANCHES OF SBI Sukanya Samriddhi ...