August 26, 2013 at 2:13 am
Hi,
I want to change the following function to a TSQL Query. Please help me in this regards.
Public Function TranslatedVal(SecCashHedge as String, ReturnType as String, Local as Decimal, BaseUnhedged as Decimal, BaseHedged as Decimal) as Decimal
Dim Val as Decimal
Val = Local
Select Case ReturnType
Case "Local"
Val = Local
Case "Base"
Val = Local
Case "Base Unhedged"
Val = BaseUnhedged
Case "Base Hedged"
Val = BaseHedged
End Select
Select Case SecCashHedge & ReturnType
Case "AcctBase"
Val = BaseHedged
Case "AcctHedgingBase"
Val = BaseHedged
Case "AcctTranslationBase"
Val = BaseHedged
Case "IndexBase"
Val = BaseHedged
Case "IndexHedgingLocal"
Val = 0
Case "IndexHedgingBase"
Val = BaseHedged
Case "IndexHedgingBase Unhedged"
Val = 0
Case "IndexHedgingBase Hedged"
Val = 0
Case "IndexTranslationLocal"
Val = 0
Case "IndexTranslationBase"
Val = BaseHedged
Case "IndexTranslationBase Unhedged"
Val = 0
Case "IndexTranslationBase Hedged"
Val = 0
Case "AcctHedging & Translation Gains/LossesBase"
Val = BaseHedged
Case "IndexHedging & Translation Gains/LossesBase"
Val = BaseHedged
End Select
Return Val
End Function
______________________________________________________________________
Ankit
MCITP Database developer SQL 2008,MCTS Database Administration SQL 2008
"Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose.
You are already naked. There is no reason not to follow your heart.”
August 26, 2013 at 2:15 am
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
August 27, 2013 at 8:35 am
I don't know if it really applies to your code but we found turning some 'functions' that were just big case statements into a 'reference' table. This really sped up our queries.
-------------------------------------------------------------
we travel not to escape life but for life not to escape us
Don't fear failure, fear regret.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply