how to sum decimal values in sql server I am working on an sql queries where i have a temp table named

 DECLARE @tcal table(TagIndex smallint,TagName nvarchar(20),Total decimal(18,2))


in which decimal numbers are used to stored. The values coming are:

284.45
233.97
240.17
81.39
67.55
0.00
71.57
72.91


I used to sum all the above decimal number by using following query:

select  sum(CAST(Total AS decimal(18,2)))  FROM @tcal where TagIndex&gt;44


The sum coming after the query is :-

767.56


But the actual result should be:

1052.01


How to solve it?
Ok it's not an anwer just a better formated comment because you are wrong in some way, I has writen the below example.

DECLARE @tcal table(TagIndex smallint,TagName nvarchar(20),Total decimal(18,2)) ;

insert into @tcal
values
 (45,null,284.45)
,(45,null,233.97)
,(45,null,240.17)
,(45,null,81.39)
,(45,null,67.55)
,(45,null,0.00)
,(45,null,71.57)
,(45,null,72.91) ;

select  sum(CAST(Total AS decimal(18,2)))  FROM @tcal where TagIndex&gt;44 ;
select  sum(Total)  FROM @tcal where TagIndex&gt;44 ;


and it works. So you are filtering your data wrong or did some mistake.

My guess is your data is missing the first row because it's tag = 44.

(Remember in SQL > &lt;> >=  =))