SUM can be used with numeric columns only. Null values are ignored.
Try this
CONVERT(Varchar(50), sum ( Cast(tn.Debit as money)),1))
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
i am facing error on below line ,want comma in value ( 48,950.00)
Operand data type varchar is invalid for sum operator.
sum ( CONVERT(Varchar(50), Cast(tn.Debit as money),1))
SUM can be used with numeric columns only. Null values are ignored.
Try this
CONVERT(Varchar(50), sum ( Cast(tn.Debit as money)),1))
Use the FORMAT function, for example
Create Table #T(Debit float);
Insert #T(Debit) Values (40000), (8950);
Select Format(Sum(Debit), 'N', 'en-us') From #T;
Tom