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)
 CONVERT PLSQL TO SQL

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-06-30 : 15:16:10
converT this PLSQL TO TSQL
help

CUSTOMER# - DECODE(Transaction Type Code,'FULL RETIREMENT',3,'PARTIAL RETIREMENT',DECODE(SAME_YEAR,'Y',3),'ADDITION',DECODE(SAME_YEAR,'Y',( DECODE(TO_NUMBER(SUBSTR(Date Entered,-2))-( TO_NUMBER(SUBSTR(Date Placed In Service,-2)) ),0,1,4) )),'ADJUSTMENT',DECODE(SAME_YEAR,'Y',( DECODE(( TO_NUMBER(SUBSTR(Date Entered,-2))-Add Year-TO_NUMBER(SUBSTR(Date Placed In Service,-2)) )+TO_NUMBER(SUBSTR(:Date,-2)),0,1,1,4,2) )))

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-30 : 15:22:02
You'll need to explain in words what it is doing. Most of do not have PLSQL experience. What does the DECODE function do?

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

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-06-30 : 20:17:06
decode in tsql is equivalent to CASE WHEN
Go to Top of Page
   

- Advertisement -