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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 PLSQL TO TSQL

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-07-01 : 12:05:52
convert this PLSQL TO TSQL

YTD_Deprn2=DECODE(SUBSTR(Period_Name,-2),SUBSTR(:Date,-2),DECODE(NVL(Prior Fy Expense,0),0,NVL(Ytd_ Deprn,0),Ytd Less Pfye),0)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-07-01 : 12:30:35
Same as your last post: You need to explain in words what it is doing.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-07-01 : 12:45:15
Something similar to this.

YTD_Deprn2 = CHOOSE(RIGHT(Period_Name, 2), RIGHT(@Date, 2), CHOOSE(ISNULL([Prior Fy Expense], 0) , 0, ISNULL([Ytd_ Deprn], 0), [Ytd Less Pfye]), 0)



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
   

- Advertisement -