Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
convert the below plsql to TSQL DECODE(BAL.CURRENCY_CODE,'STAT',0,NVL(BAL.PROJECT_TO_DATE_DR,0)-NVL(BAL.PROJECT_TO_DATE_CR,0)+(NVL(BAL.PERIOD_NET_DR,0)-NVL(BAL.PERIOD_NET_CR,0))) CLOSING_BAL_AMTI am using this code but the numbers are off CASE WHEN BAL.CURRENCY_CODE = 'STAT' THEN 0 ELSE (ISNULL(BAL.PROJECT_TO_DATE_DR,0) - ISNULL(BAL.PROJECT_TO_DATE_CR,0) + (ISNULL(BAL.PERIOD_NET_DR,0) - ISNULL(BAL.PERIOD_NET_CR,0)) )please advise
ScottPletcher
Aged Yak Warrior
550 Posts
Posted - 2014-03-07 : 10:31:24
The only difference I can see is that you've added some parentheses. And given that you're doing only + and -, not sure why that's causing an issue.
CASE WHEN BAL.CURRENCY_CODE = 'STAT' THEN 0 ELSE ISNULL(BAL.PROJECT_TO_DATE_DR,0) - ISNULL(BAL.PROJECT_TO_DATE_CR,0) + ISNULL(BAL.PERIOD_NET_DR,0) - ISNULL(BAL.PERIOD_NET_CR,0) END AS CLOSING_BAL_AMT