Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 31st, 2012  |  syntax: None  |  size: 1.91 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to convert below SQL Expression into derived column in SSIS [closed]
  2. CASE
  3.         WHEN CHARINDEX('%', '{FixedARMRateReductionLimit}') > 0 THEN
  4.             CAST(SUBSTRING('{FixedARMRateReductionLimit}', 0,
  5.                CHARINDEX('%', '{FixedARMRateReductionLimit}')) as decimal)/100
  6.         WHEN '{FixedARMRateReductionLimit}' = 'Weekly PMMS Rate' THEN
  7.             PARAM_VAL_TXT
  8.         ELSE
  9.             .02
  10.     END
  11.        
  12. SELECT '50%' AS FixedARMRateReductionLimit, .1 AS PARAM_VAL_TXT
  13. UNION ALL  SELECT 'Weekly PMMS Rate' AS FixedARMRateReductionLimit, .3 AS PARAM_VAL_TXT
  14. UNION ALL  SELECT 'Frack',  .5
  15.        
  16. FINDSTRING(FixedARMRateReductionLimit, "%",1)
  17.        
  18. FixedARMRateReductionLimit == "'Weekly PMMS Rate"
  19. FINDSTRING(FixedARMRateReductionLimit,"Weekly PMMS Rate",1)
  20.        
  21. (RateTextPosition > 0) ? (PARAM_VAL_TXT) : (PercentPosition == 0) ? .2 : ((DT_NUMERIC, 18,2) SUBSTRING(FixedARMRateReductionLimit,1,PercentPosition - 1))/100
  22.        
  23. (FINDSTRING(FixedARMRateReductionLimit,"%",1) > 1) ? ((DT_NUMERIC,5,2)SUBSTRING(FixedARMRateReductionLimit,1,FINDSTRING(FixedARMRateReductionLimit,"%",1) - 1)) : (FixedARMRateReductionLimit == "Weekly PMMS Rate" ? (0.35) : (0.02))
  24.        
  25. (FINDSTRING(FixedARMRateReductionLimit,"%",1) > 1)
  26.     ?   (
  27.             (DT_NUMERIC,5,2)
  28.                 SUBSTRING(  FixedARMRateReductionLimit,
  29.                             1,
  30.                             FINDSTRING(FixedARMRateReductionLimit, "%", 1) - 1
  31.                           )
  32.         )
  33.     :   FixedARMRateReductionLimit == "Weekly PMMS Rate"
  34.             ? (0.35)
  35.             : (0.02))
  36.        
  37. SELECT c1 AS FixedARMRateReductionLimit
  38. FROM
  39. (
  40.             SELECT '2.00%'              AS c1
  41.     UNION   SELECT '13.95%'             AS c1
  42.     UNION   SELECT '%52.00%'            AS c1
  43.     UNION   SELECT '%%'                 AS c1
  44.     UNION   SELECT '85.%42%'            AS c1
  45.     UNION   SELECT 'Weekly PMMS Rate'   AS c1
  46.     UNION   SELECT 'Monthly PMMS Rate'
  47. ) T1