![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Programmer
Join Date: Oct 2005
Posts: 48
Rep Power: 0
![]() |
Transact SQL
declare @a decimal select @a = SUM(A.Amt)-SUM( B.SubAmt) from [UA-FAM]..FAM_Txn A Join [UA-DSM]..DSM_Txn B ON( A.TxnID = B.TxnID) where A.CardID IN (SELECT CardID FROM [UA-FAM]..FAM_CardAcct WHERE FAID = 9) AND A.Status IN(1,5) AND MONTH(A.DateCreated) = MONTH(GETDATE()) select ISNULL(@a, 0) A Output: Quote:
The expected result should be 126.98. Why the output is converted to 127???? ![]() |
|
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 825
Rep Power: 4
![]() |
You could try using ISNULL(@a, 0.0), just in case ISNULL is converting the value of @a to the type of the default value.
Edit: Looking at MSDN it seems that "decimal" means zero digits to the right of the decimal point. You might want to try chaging your definition of @a to "decimal(18,2)" or even "float". |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|